title: React Native TouchableOpacity OnPress not Working with loop
body: <p>I have a scrollview in which multiple items are generated with loop. I added TouchableOpacity above these items because i want these objects to be touchable. But when i add a method on onPress method it shows error <strong>not a function , is undefined</strong></p>
  
  <p><strong>List_Data Component:</strong></p>
  
  <pre><code>class List_Data extends React.Component {
  
      fetchData = () =&gt; {
          console.log("DONE");
      }
  
      _renderView = () =&gt; {
          return (
              &lt;View style={{flex:1, padding: 20}}&gt;
                          &lt;View style={styles.container}&gt;
                              &lt;ScrollView horizontal={true} showsHorizontalScrollIndicator={false} &gt;
                                  {
                                      this.state.Data.map(function (data, index) {
                                          return (
                                              &lt;TouchableOpacity key={index} onPress={() =&gt; this.fetchData()}&gt;
                                                  &lt;Image source={{uri: data.imageSrc}}
                                                         resizeMode={'cover'}
                                                         style={{width: '100%', height: imageHeight}}
                                                  /&gt;
                                              &lt;/TouchableOpacity&gt;
                                          );
                                      })
                                  }
                              &lt;/ScrollView&gt;
                          &lt;/View&gt;
                      &lt;/View&gt;
          )
      }
  
  
      render() {
          return (
              {this._renderView()}
          );
      }
  }
  </code></pre>
  
  <p>I don't know whats the issue, it just a method which prints on console. </p>