How can we handle on press in items?
See original GitHub issueThanks for very nice plugin. I am newbie at React Native. I could not handle on press to child item. Is it something that I could figure out or possible issue to be fixed?
_renderItem (content, index) {
return (
<View key={"tours"+index}>
<TouchableOpacity onPress={this.handlePressSend}>
<Image source={{uri: 'https://res.cloudinary.com/dhtfjpv7o/image/upload/c_fill,e_art:primavera,g_auto,h_300,w_400/v1479733803/jpfj4ilkpmst3kz697z8.jpg'}} style={styles.tourImage} />
</TouchableOpacity>
</View>
);
}
On press method;
handlePressSend = () => {
console.log('pressed')
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:11 (3 by maintainers)
Top Results From Across the Web
How can we handle on press in items? · Issue #9 - GitHub
I'm pretty confident that this is a classic 'function binding' issue. Try binding your method in the class constructor, like this : this....
Read more >Pressable React Native Tutorial - How to Handle Presses ...
... How to Handle Presses, Long Presses and Style On Component Press ... I always have many things on the go and am...
Read more >Handle on press in a react-native custom component
I need to handle the on click on the items. The problem is that the on press on the TouchableOpacity in the widget...
Read more >Handling long-press gestures | Apple Developer Documentation
Overview. Long-press (also known as press-and-hold) gestures detect one or more fingers (or a stylus) touching the screen for an extended period of...
Read more >Create a Press and Hold Effect - KIRUPA
Learn how to create the popular press-and-hold gesture you commonly see in our ... <script> // The item (or items) to press and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@bd-arc thanks for answer. I change my render function like this:
renderItem={item => this._renderItem(item)}
and component didnt lose its function instanceIt actually seems the press is not detected at all – the button does not get highlighted. Like something is blocking the touch gesture