Description
With a Text component nested inside any touchable (e.g. TouchableOpacity), a failed touch of Text should bubble the event back up to the wrapping touchable, as happens with React Native components. However, the Text component seems to trap the event and it does not bubble up to the touchable reliably. In React Native, this works fine -- if the Text has an onPress or onLongPress, it intercepts the touch. Otherwise, the touch bubbles up to the next handler. This is useful e.g. for copying a line of text, but also being able to click a link within the line.
Steps to reproduce
- Run the reproducer
- See that touching
Touchable Text never increases the counter nor highlights the line
- Touching
Outer and Inner work as expected
- Change to React Native
TouchableOpacity and Text components
- Touching
Touchable Text increments the counter, as does touching Outer and Inner
Snack or a link to a repository
https://github.com/mhoran/react-native-scratch/blob/rngh-touchable-text/ReproducerApp/App.tsx
Gesture Handler version
2.22.0
React Native version
0.76.6
Platforms
iOS
JavaScript runtime
Hermes
Workflow
React Native (without Expo)
Architecture
Paper (Old Architecture)
Build type
None
Device
Real device
Device model
iPad Air 11-inch (M2)
Acknowledgements
Yes
Description
With a
Textcomponent nested inside any touchable (e.g.TouchableOpacity), a failed touch ofTextshould bubble the event back up to the wrapping touchable, as happens with React Native components. However, theTextcomponent seems to trap the event and it does not bubble up to the touchable reliably. In React Native, this works fine -- if theTexthas anonPressoronLongPress, it intercepts the touch. Otherwise, the touch bubbles up to the next handler. This is useful e.g. for copying a line of text, but also being able to click a link within the line.Steps to reproduce
Touchable Textnever increases the counter nor highlights the lineOuterandInnerwork as expectedTouchableOpacityandTextcomponentsTouchable Textincrements the counter, as does touchingOuterandInnerSnack or a link to a repository
https://github.com/mhoran/react-native-scratch/blob/rngh-touchable-text/ReproducerApp/App.tsx
Gesture Handler version
2.22.0
React Native version
0.76.6
Platforms
iOS
JavaScript runtime
Hermes
Workflow
React Native (without Expo)
Architecture
Paper (Old Architecture)
Build type
None
Device
Real device
Device model
iPad Air 11-inch (M2)
Acknowledgements
Yes