title: ReactNative Flatlist onEndReached not working
body: <p>Im trying to call a function on <code>onEndReached</code> of a FlatList but it's not working.</p>
  
  <p>I'm calling the <code>this.state.pageNo</code> at the end and it's not updating. I want to use this logic later in infinite scroll but not able to get it working now.</p>
  
  <pre><code> import React, { Component } from "react";
   import {
    View,
    Text,
    StyleSheet,
    Button,
    TouchableOpacity,
    FlatList,
    Alert
    } from "react-native";
  
   class InfiniteScrollRedux extends Component {
     constructor(props) {
        super(props);
        this.state = {
          loading: false,
          pageNo: 1,
          data: [
              { id: 1, name: "Name01" },
              { id: 2, name: "Name02" },
              { id: 3, name: "Name03" },
              { id: 4, name: "Name04" },
              { id: 5, name: "Name05" },
              { id: 6, name: "Name06" }
          ]
      };
  }
  
  myFunction = () =&gt; {
      this.setState({ pageNo: this.state.pageNo++ });
  };
  
  render() {
      return (
          &lt;View&gt;
              &lt;FlatList
                  data={this.state.data}
                  renderItem={({ item }) =&gt; (
                      &lt;View style={mystyle.mainCard}&gt;
                          &lt;Text style={mystyle.titleText}&gt; {item.id} &lt;/Text&gt;
                          &lt;View style={{ marginTop: 200 }} /&gt;
                          &lt;Text style={mystyle.nameText}&gt; {item.name} &lt;/Text&gt;
                      &lt;/View&gt;
                  )}
                  keyExtractor={item =&gt; item.id}
                  onEndReached={this.myFunction}
                  onEndThreshold={0}
              /&gt;
              &lt;Text style={{ margin: 20, padding: 20, fontSize: 20 }}&gt;
                  {this.state.pageNo}
              &lt;/Text&gt;
          &lt;/View&gt;
        );
     }
  }
  
  const mystyle = StyleSheet.create({
   mainCard: {
      backgroundColor: "#2F4F4F",
      marginBottom: 1,
      padding: 5
  },
  titleText: {
      fontSize: 20,
      color: "#F0FFFF"
  },
  nameText: {
      fontSize: 14,
      color: "#F0FFFF"
   }
   });
  
   export default InfiniteScrollRedux;
  </code></pre>