question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How can we handle on press in items?

See original GitHub issue

Thanks 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:closed
  • Created 7 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

18reactions
sfatihcommented, Feb 23, 2018

@bd-arc thanks for answer. I change my render function like this: renderItem={item => this._renderItem(item)} and component didnt lose its function instance

0reactions
oferRoundscommented, May 22, 2019

It actually seems the press is not detected at all – the button does not get highlighted. Like something is blocking the touch gesture

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found