[iOS] Fix js responder cancelation in modals - #4306
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes an iOS responder-cancellation edge case when gestures activate inside react-native-screens routes presented as formSheet/modal, ensuring underlying RN Pressable/Touchable* touches are properly cancelled.
Changes:
- Stop the root-recognizer registration walk-up at a modally-presented
RNSScreenView, so the root recognizer is attached to a view that will move with UIKit reparenting. - Retry root attachment once on the next main run loop turn if the ancestor chain is temporarily incomplete during Fabric mounting.
- When cancelling JS responder touches, fall back to using an
RNSScreenView’stouchHandlerif it’s not directly present in the view’s recognizers.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
j-piasecki
reviewed
Jul 8, 2026
j-piasecki
approved these changes
Jul 8, 2026
coado
approved these changes
Jul 8, 2026
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
On iOS, when a gesture activates inside a
react-native-screensroute presented asformSheetormodal, the in-flight touch of a core RNPressable/Touchableunderneath is not cancelled — the press completes andonPressfires on release, alongside the gesture.In this PR registration walk-up now also stops at a modally-presented
RNSScreenView, so the root recognizer is attached to the screen view and travels with it whenUIKitreparents it. When the walk-up dead-ends atnil, registration is retried once on the next run loop turn, when the mounting transaction has finished and the hierarchy is connected.Fixes #4305
Test plan
Tested on the following code: