title: how to add an event listener to a state in react native
body: <p>I'm trying to scroll to the end of my <code>FlatList</code> when the state of <code>messages</code> changes. Currently I'm using <code>this.refs.flatList.scrollToEnd();</code> after waiting a bit, which works OK. What I want to do is add an event listener to the <code>messages</code> state so that when the list is changed in any way it will scroll to the end of the list. I tried </p>
  
  <pre><code>componentDidMount(){
          this.state.messages.addEventListener('change', this._handleNewMessage);
  }
  </code></pre>
  
  <p>but it doesn't work. Does anyone know a way I can achieve this?</p>