Buttons do not trigger onPress if inside TapGestureHandler
See original GitHub issueI have BaseButton inside a TapGestureHandler.
In Android, pressing the button will trigger both onHandlerStateChange from TapGestureHandler and onPress & onActiveStateChange from BaseButton.
In iOS, pressing the button triggers the onHandlerStateChange from TapGestureHandler and the onActiveStateChange from BaseButton. However, onPress is never triggered.
I added the waitFor but I still get the same result. Any help?
btnRef = React.createRef()
{...}
render() {
return (
<TapGestureHandler onHandlerStateChange={this.onHandlerStateChange} /* waitFor={this.btnRef} */>
{...}
<BaseButton
// ref={this.btnRef}
onPress={onPress}
onActiveStateChange={this.onActiveStateChange}
style={style}
enabled={enabled}
{...otherProps}
>
{this.props.children}
</BaseButton>
{...}
</TapGestureHandler>
)}
Issue Analytics
- State:
- Created 5 years ago
- Reactions:15
- Comments:8
Top Results From Across the Web
Buttons do not trigger onPress if inside TapGestureHandler
I have BaseButton inside a TapGestureHandler. In Android, pressing the button will trigger both onHandlerStateChange from TapGestureHandler ...
Read more >React Native TapGestureHandler - how to call a function and ...
If i do that it says this2.onButtonClicked is not a function. Maybe it is possible to call the Animated.Event from a function? –...
Read more >Buttons | React Native Gesture Handler - Software Mansion
Gesture handler library provides native components that can act as buttons. These can be treated as a replacement to TouchableHighlight or TouchableOpacity ...
Read more >React Native Gesture Handler: Swipe, long-press, and more
Implementing gestures in a React Native app improves the user experience. Learn how to create swipeable, pan, long-press, and other ...
Read more >#14 Custom Tap Gesture — React Native Fashion - YouTube
In this series, we are building a React Native App from 0 to 1.The source code is available via the Start React Native...
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 Free
Top 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
Are there any updates for this?
For anyone still looking for this:
Using the
react-native-gesture-handler
buttons, you can use the propdisallowInterruption
which will cancel parent gesture handler events