title: Why this.setState is not a function?
body: <p>I create a <code>&lt;FlatList /&gt;</code> include <code>&lt;Text /&gt;</code> , i want to click each of the <code>&lt;Text /&gt;</code> can change <code>this.state</code>.</p>
  
  <p>But when i click it that will show error:</p>
  
  <pre><code>this.setState is not a function
  </code></pre>
  
  <p>Why?  </p>
  
  <p>Here is my <code>&lt;FlatList /&gt;</code>:</p>
  
  <pre><code>render() {
      return (
        &lt;View&gt;
  
          &lt;FlatList
            ListHeaderComponent={() =&gt; (
              !cityArray.length ? (
                &lt;View style={{ height: 300 }}&gt;
                  &lt;Text style={styles.sectionTitle}&gt;
                    Show empty message...
                  &lt;/Text&gt;
                &lt;/View&gt;) : null
            )}
            data={cityArray}
            renderItem={this.renderItem} 
            horizontal={true}
            keyExtractor={(item, index) =&gt; index.toString()}
          /&gt;
  
        &lt;/View&gt;
      );
    }
  </code></pre>
  
  <p>Here is my <code>renderItem</code> function: <code>onPress</code> will shows the error</p>
  
  <pre><code>renderItem({ item }) {
      return (
        &lt;View style={styles.headerView}&gt;
          &lt;TouchableOpacity 
            onPress={() =&gt; {
              this.setState({ test: 'test press' });
            }}
          &gt;
            &lt;Text&gt;{item.cnCity}&lt;/Text&gt;
          &lt;/TouchableOpacity&gt;
        &lt;/View&gt;      
      );
    }
  </code></pre>
  
  <p>My this.state:</p>
  
  <pre><code>  constructor(props) {
      super(props);
      // this.renderRow = this.renderRow.bind(this);
      this.state = { tickets: [], selectedOption: '', theaters: [], test: '' };
    }
  </code></pre>
  
  <p>I try to creat another function:</p>
  
  <pre><code>  testPress = () =&gt; {
      this.setState({ test: 'test function' });
    }
  </code></pre>
  
  <p>and use it like:</p>
  
  <pre><code>renderItem({ item }) {
      return (
        &lt;View style={styles.headerView}&gt;
          &lt;TouchableOpacity 
            onPress={() =&gt; {
              this.testPress();
            }}
          &gt;
            &lt;Text&gt;{item.cnCity}&lt;/Text&gt;
          &lt;/TouchableOpacity&gt;
        &lt;/View&gt;      
      );
    }
  </code></pre>
  
  <p>It still shows the same error. Why? I can't figure it out.</p>
  
  <p>Any help would be appreciated. </p>