-
-
Notifications
You must be signed in to change notification settings - Fork 987
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Text component does not propagate touch to parent on gesture failure #3331
Comments
I also noticed I get a warning about |
Hi @mhoran! I've spent some time trying to understand what happens on the native side with I'd also like to mention that handling nested <TouchableOpacity ...>
<Text ...> {/* Wrapper */}
<Text ...>
<Text ...> {/* Outer text */}
<Text ...> {/* Nested Text */} In that case, native hierarchy will have only one As for error with view flattening, that's true that it is not possible to add |
Thanks for taking a look. I had tried something similar to #3336, but it doesn't seem to work for my purposes, likely due to the text flattening you've described. I see the same issue if I try to wrap nested text with my own I need the nested text, otherwise word wrapping does not work as expected (especially with long URLs.) I see other React Native apps that seem to be using native gestures in a |
#3338 does resolve the Regarding the difference in behavior between React Native and RNGH components, see the following screen recordings. The first shows what I'm seeing with RNGH. I believe this is due to the situation you described above; the collapsing of the rngh-text.mp4With React Native native-text.mp4 |
The only thing that I was able to find was a mechanism that allows React Native to detect which part of text was clicked by getting appropriate |
) ## Description This PR replaces our `Text` component with default RN component, when `onPress` or `onLongPress` callbacks are not provided. Should help with #3331 ## Test plan Tested on code from _**NestedText**_ example with variations: Additional `View`/`Text` inside `Touchable`, with/without `onPress` on outer `Text`.
Description
With a
Text
component nested inside any touchable (e.g.TouchableOpacity
), a failed touch ofText
should bubble the event back up to the wrapping touchable, as happens with React Native components. However, theText
component seems to trap the event and it does not bubble up to the touchable reliably. In React Native, this works fine -- if theText
has anonPress
oronLongPress
, 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 Text
never increases the counter nor highlights the lineOuter
andInner
work as expectedTouchableOpacity
andText
componentsTouchable Text
increments the counter, as does touchingOuter
andInner
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
The text was updated successfully, but these errors were encountered: