[iOS] Fix hooks API not cancelling JS Responder - #4261
Merged
j-piasecki merged 1 commit intoJun 15, 2026
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes iOS hook-API GestureDetector activation not cancelling the JS responder by ensuring RNRootViewGestureRecognizer gets installed on the appropriate surface/touch-handler view when detectors attach handlers (matching the legacy attach path behavior).
Changes:
- Added
attachHandlerForDetectorWithTag:toView:withActionType:withHostDetector:toRNGestureHandlerManagerto attach a handler and register the surface view for JS-responder cancellation. - Updated
RNGestureHandlerDetectorto route detector-driven handler attachment through the new manager method (instead of attaching directly via the registry).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/react-native-gesture-handler/apple/RNGestureHandlerManager.mm | Adds a detector-specific attach helper that also installs the root gesture recognizer via registerViewWithGestureRecognizerAttachedIfNeeded:. |
| packages/react-native-gesture-handler/apple/RNGestureHandlerManager.h | Exposes the new manager attach helper for use by the detector. |
| packages/react-native-gesture-handler/apple/RNGestureHandlerDetector.mm | Switches detector attachment sites to use the new manager helper so JS responder cancellation can occur. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
m-bert
approved these changes
Jun 15, 2026
j-piasecki
deleted the
@jpiasecki/fix-hook-api-not-cancelling-js-responder
branch
June 15, 2026 09:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #4258
JS-responder cancellation relies on
RNRootViewGestureRecognizerbeing installed on the surface view. The legacy path installs it in maybeBindHandler viaregisterViewWithGestureRecognizerAttachedIfNeeded, but the hook-API detector attached handlers straight to the registry and skipped that step, so activation could never cancel the JS responder.This PR adds
attachHandlerForDetectorWithTag:toView:withActionType:withHostDetector:onRNGestureHandlerManagerwhich handles that.Test plan
Tested on the issue reproducer