[ios] fix pressable with intercepting detector#4041
[ios] fix pressable with intercepting detector#4041akwasniewski wants to merge 3 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes iOS Pressable activation when an InterceptingGestureDetector under the pressable causes touches to land on nested text views, preventing the outer button from receiving the expected control events.
Changes:
- Added
touchesBegan/Ended/Cancelledoverrides on iOS to dispatchUIControlactions when the touch originates from a subview rather than the button itself.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/react-native-gesture-handler/apple/RNGestureHandlerButton.mm
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/react-native-gesture-handler/apple/RNGestureHandlerButton.mm
Outdated
Show resolved
Hide resolved
9928ede to
1d394d9
Compare
1d394d9 to
81d2554
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Description
On iOS, when under pressable, we had an intercepting detector handling a nested text gesture, pressable did not activate when we pressed on the part of the text with no virtual gesture attached to it. This PR should fix the issue.
The problem was that when the button was hit-testing its children, it assumed that the gesture recognizer always wanted to receive events (it was only checking whether there was any). The new implementation goes through the list of found recognizers, checking if they want to handle touch at the specified point.
Note: on web the nested text gesture never activates when under a pressable, web needs further care.
Test plan
Tested on the following example
Details