title: How to add Click Event on FlatList Item in React Native?
body: <p>I am working in demo Application for learning <code>React native</code> And I need to render clickable <code>FlatList</code> item.</p>
  
  <p>Here is <code>Render</code> and <code>itemClick</code> function:</p>
  
  <pre><code>render() {
    return (
      &lt;View style={styles.container}&gt;
        &lt;View&gt;
          &lt;FlatListData list={this.state.itemList} /&gt;
        &lt;/View&gt;
      &lt;/View&gt;
    );
  }
  
  itemClick(item){
    console.log('click on item', item);
  }
  </code></pre>
  
  <p>I have already declare <code>FlatListData</code> functional component for that : </p>
  
  <pre><code>const FlatListData = ({list}) =&gt; {
      return (
        &lt;FlatList
          data={list}
          keyExtractor={(item, index) =&gt; index.toString()}
          renderItem={itemList}
        /&gt;
      );
  };
  </code></pre>
  
  <p>In <code>FlatList</code> component, <code>RenderItem</code> attribute have again custom component for single item i.e : </p>
  
  <pre><code>const itemList = ({item, index}) =&gt; {
    return (
        &lt;TouchableOpacity onPress={this.itemClick(item)} style={styles.catalogContainer}&gt;
          &lt;Image
            source={{uri: item.img}}
            style={styles.imageStyle}
          /&gt;
        &lt;/TouchableOpacity&gt;
      );
  };
  </code></pre>
  
  <p>But this code is not working. It will give me error like : <code>Undefined is not an object (eveluting _this.itemClick)</code></p>
  
  <p><strong>Here in which way and where Should I write click function for item ?</strong></p>
  
  <p><strong>Any one have a answer that can solve my problem ?</strong></p>
  
  <p><strong>NOTE :</strong>  </p>
  
  <ol>
  <li>All code is written in one <code>js file</code>. My <code>Render</code>  function is inside my class component. and other two <code>declarative</code> component are out of that class component.</li>
  <li>I need that item inside that click function. But I don't know how to pass parameter inside function.</li>
  </ol>