Skip to content

[iOS] Fix handler retrieval and mismatched coordinate space#4199

Merged
j-piasecki merged 2 commits into
mainfrom
@jpiasecki/fix-handler-retrieval-and-coordinate-space
May 27, 2026
Merged

[iOS] Fix handler retrieval and mismatched coordinate space#4199
j-piasecki merged 2 commits into
mainfrom
@jpiasecki/fix-handler-retrieval-and-coordinate-space

Conversation

@j-piasecki

@j-piasecki j-piasecki commented May 27, 2026

Copy link
Copy Markdown
Member

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, 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
Simulator.Screen.Recording.-.iPhone.17.Pro.-.2026-05-27.at.12.15.34.mov
Simulator.Screen.Recording.-.iPhone.17.Pro.-.2026-05-27.at.12.16.11.mov

There's no pointer captured, but in the "before" video, I'm trying to scroll starting on Nested buttons (sound & ripple).

Copilot AI review requested due to automatic review settings May 27, 2026 10:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR targets iOS gesture handling correctness by improving handler lookup for recognizers and fixing coordinate-space conversion when button hit testing consults gesture handlers.

Changes:

  • Updates findGestureHandlerByRecognizer to use Fabric component-view detection.
  • Aligns wantsToHandleEventsAtPoint subview hit-testing with host detector checks.
  • Converts button hit-test points into the resolved handler recognizer view.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/react-native-gesture-handler/apple/RNGestureHandler.mm Adjusts handler lookup and native/virtual detector hit-test view selection.
packages/react-native-gesture-handler/apple/RNGestureHandlerButton.mm Fixes point conversion before asking a resolved handler whether it wants the touch.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/react-native-gesture-handler/apple/RNGestureHandler.mm Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@j-piasecki j-piasecki merged commit b1da40b into main May 27, 2026
4 checks passed
@j-piasecki j-piasecki deleted the @jpiasecki/fix-handler-retrieval-and-coordinate-space branch May 27, 2026 11:03
j-piasecki added a commit that referenced this pull request May 27, 2026
## Description

The updated loop in
#4199
didn't accurately represent the semantics from the old arch. It didn't
stop on the views managed by React Native, instead iterating to the root
of the hierarchy.

## Test plan

Checked that it doesn't regress
#4199
m-bert added a commit that referenced this pull request Jun 11, 2026
## Description

Cherry pick thread for release 2.32

## List of PRs

| PR  | Original commit |  Picked commit | Without confilct | 
|:----------:|:-------------:|:------:|:--------:|
| [[Android] Remove
`getChildInDrawingOrderAtIndex`](#4156)
|
[f1f09bc](f1f09bc)
|
[d76f2d9](d76f2d9)
| ❌ |
| [[iOS] Fix duplicated
`testID`](#4186)
|
[7feab6e](7feab6e)
|
[d1173ec](d1173ec)
| ❌ |
| [[Android] Fix discrete gestures not triggering
`onFinalize`](#4196)
|
[117087e](117087e)
|
[06212cf](06212cf)
| ✅ |
| [[Android] Fix wrong reported number of
pointers](#4218)
|
[f17bcbd](f17bcbd)
|
[5fd30f6](5fd30f6)
| ❌ |
| [fix(pods): Fix invalid `react-native/../react-native` resolution for
aliases](#4232)
|
[9a9f8b4](9a9f8b4)
|
[cacf6c0](cacf6c0)
| ✅ |
| [Move ruby utils to
module](#4245)
|
[62d0d52](62d0d52)
|
[3884f30](3884f30)
| ❌ |
| [[iOS] Fix handler retrieval and mismatched coordinate
space](#4199)
|
[b1da40b](b1da40b)
|
[2b48a8e](2b48a8e)
| ❌ |
| [[iOS] Don't iterate to root while resolving
recognizer](#4202)
|
[fba4dcc](fba4dcc)
|
[b81f2aa](b81f2aa)
| ❌ |
| [Support React Native
0.86](#4166)
|
[96dfc00](96dfc00)
|
[7df6d1a](7df6d1a)
| ❌ |
| [Fix `RNRenderer` import for React Native
0.86](#4160)
|
[0417378](0417378)
|
[6775d33](6775d33)
| ❌ |
| [Bump `expo` to stable
56](#4227)
|
[45e6ac8](45e6ac8)
|
[0478bb5](0478bb5)
| ❌ |
| [[macOS] Bump example
app](#3993)
|
[8ec0820](8ec0820)
|
[cfc5dd4](cfc5dd4)
| ❌ |
| [Bump
Reanimated](#4040)
|
[23d96d9](23d96d9)
|
[a2101eb](a2101eb)
| ❌ |
| [fix(Android): apply `numberOfPointers` config to the pointer
requirement in
`LongPressGestureHandler`](#4253)
|
[a70c6e3](a70c6e3)
|
[af40f9b](af40f9b)
| ✅ |

## Test plan

Tested that example apps are built correctly

---------

Co-authored-by: Pieter De Baets <pieter.debaets@gmail.com>
Co-authored-by: Mathieu Acthernoene <zoontek@gmail.com>
Co-authored-by: Jakub Piasecki <jakub.piasecki@swmansion.com>
Co-authored-by: Phil Pluckthun <phil@kitten.sh>
Co-authored-by: prashanFOMO <prashan@fomo.family>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants