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.

TouchableOpacity inside of TapGestureHandler

See original GitHub issue

I have many <TouchableOpacity /> components inside of one big container component that has a TapGestureHandler on it. For example:

import { TouchableOpacity } from 'react-native-gesture-handler'
public render() {
        return (
            <TapGestureHandler
                onHandlerStateChange={this._onSingleTap}
            >
                 <TouchableOpacity />
                 <TouchableOpacity />
            </TapGestureHandler>
        )
    }

The above example is a very basic one. In reality, my view is very complex and has many different TouchableOpacitys in addition to many TextInputs spanning across many wrapper components.

Currently, when tapping on one of the TouchableOpacitys, only TapGestureRecognizer.onHandlerStateChange is called. The exact opposite should happen, TouchableOpacity.onPress should get called and TapGestureRecognizer.onHandlerStateChange should NOT get called.

This is a very big issue for me, I would appreciate any help I can get! Has this been fixed in the upgrade branch?

Zach

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:26
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

10reactions
sa8abcommented, Nov 5, 2020

Try putting each TouchableOpacity inside a TapGestureHandler

            <TapGestureHandler
                onHandlerStateChange={this._onSingleTap}
            >
                //.....
                  <TapGestureHandler>
                        <TouchableOpacity />
                  <TapGestureHandler/>
                  <TapGestureHandler>
                        <TouchableOpacity />
                  <TapGestureHandler/>
                //.....
            </TapGestureHandler>
3reactions
vldslvmgycommented, Jun 29, 2020

is there any updates on this issue, facing the exact same one right now

Read more comments on GitHub >

github_iconTop Results From Across the Web

TouchableOpacity not working inside an absolute positioned ...
I have an absolute-positioned View that holds three TouchableOpacity components, and the three fail to respond they are just ...
Read more >
Touchables | React Native Gesture Handler - Software Mansion
Gesture Handler's TouchableOpacity uses native driver for animations by default. If this causes problems for you, you can set useNativeAnimations prop to ...
Read more >
Create a Touchable Opacity Button with Reanimated in React ...
In this lesson we'll explore using Reanimated and React Native Gesture Handler to create a button using TapGestureHandler.
Read more >
Troubleshooting | React Native Bottom Sheet - GitHub Pages
Due to wrapping the content and handle with TapGestureHandler & PanGestureHandler , any gesture interaction would not function as ... TouchableOpacity,
Read more >
Nested TapGestureHandler triggering parent ... - Reddit
Is it just not possible to nest TapGestureHandlers like this? Obviously it's possibly using react-native's TouchableOpacity, and even react- ...
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