Commit b1da40b
authored
[iOS] Fix handler retrieval and mismatched coordinate space (#4199)
## Description
Fixes three issues:
1. `findGestureHandlerByRecognizer` was relying on `reactTag` to
determine whether a view is managed by React Native. This is no longer
set on the new architecture (we do it
[here](https://github.com/software-mansion/react-native-gesture-handler/blob/e362f3a1ea2c04b78d3923c377dc2c62b23ca2d0/packages/react-native-gesture-handler/apple/RNGestureHandlerManager.mm#L206),
this needs to be investigated). Instead, I changed it to check whether
the view is a subclass of `RCTViewComponentView` which is a base for
Fabric components.
2. `shouldHandleTouch` in the button component was converting the point
to the wrong coordinate space when calling `wantsToHandleEventsAtPoint`.
3. `wantsToHandleEventsAtPoint` for api v3 was always trying to get the
child of the view the gesture is attached to. Correct when gesture is
attached to the detector, not when directly to view (virtual
detector/`wantsToAttachDirectlyToView: YES`).
## Test plan
Enable "Legacy examples" in the expo app and try to scroll, starting on
one of the disabled buttons.
|Before|After|
|-|-|
|<video
src="https://github.com/user-attachments/assets/28cd0b95-85df-46e8-8ca4-28c042d725b0"
/>|<video
src="https://github.com/user-attachments/assets/7116d3aa-557f-4828-9b4e-c0177ed89202"
/>|
There's no pointer captured, but in the "before" video, I'm trying to
scroll starting on `Nested buttons (sound & ripple)`.1 parent e362f3a commit b1da40b
2 files changed
Lines changed: 10 additions & 9 deletions
Lines changed: 9 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
640 | 640 | | |
641 | 641 | | |
642 | 642 | | |
643 | | - | |
644 | | - | |
645 | | - | |
646 | | - | |
647 | | - | |
648 | | - | |
649 | | - | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
650 | 648 | | |
| 649 | + | |
| 650 | + | |
651 | 651 | | |
652 | 652 | | |
653 | 653 | | |
| |||
816 | 816 | | |
817 | 817 | | |
818 | 818 | | |
819 | | - | |
| 819 | + | |
| 820 | + | |
820 | 821 | | |
821 | 822 | | |
822 | 823 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
850 | 850 | | |
851 | 851 | | |
852 | 852 | | |
853 | | - | |
| 853 | + | |
854 | 854 | | |
855 | 855 | | |
856 | 856 | | |
| |||
0 commit comments