I want to call a function on clicking of an Item in corousel. below is my code.
onPress(){
console.log("onPress");
}
_renderItem({item, index}) {
return (
<TouchableWithoutFeedback
onPress={this.onPress.bind(this)}>
<View style={styles.slide}>
<Image
source={{ uri: item.row.image_name }}
style={styles.image}
/>
</View>
</TouchableWithoutFeedback>
);
}
When I click the item I am getting error saying _this6.onPress is not a function
.
I am able to alert directly on click like below.
<TouchableWithoutFeedback onPress={()=>{ Alert.alert("onPress");}}>
How can I call a method on Item click?
demo code: https://snack.expo.io/SJtm1vJMX