[iOS] Handle FullWindowOverlay as the native root#4039
Merged
j-piasecki merged 2 commits intomainfrom Mar 27, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates iOS root-view traversal in RNGestureHandlerManager so RNGH can treat Screens’ FullWindowOverlay container as a native root (similar to RCTSurfaceView), enabling the RNRootViewGestureRecognizer path to run in that hierarchy.
Changes:
- Adds a runtime check for
RNSFullWindowOverlayContainerviaNSClassFromString. - Extends the superview traversal stop-condition to stop at either
RCTSurfaceVieworRNSFullWindowOverlayContainer.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/react-native-gesture-handler/apple/RNGestureHandlerManager.mm
Outdated
Show resolved
Hide resolved
j-piasecki
added a commit
that referenced
this pull request
Mar 27, 2026
## Description Current logic dedicated to handling `RNRootViewGestureRecognizer` on iOS looks only for RN's native roots. When gestures are used inside Screens' `FullWindowOverlay`, the logic doesn't do anything, but the overlay has its own [`RCTSurfaceTouchHandler`](https://github.com/software-mansion/react-native-screens/blob/be64b6d9a17c3a4647806f252e075b96b9f690cc/ios/RNSFullWindowOverlay.mm#L158). This PR updates the traversal logic so it handles `RNSFullWindowOverlayContainer` the same way as `RCTSurfaceView`. ## Test plan I wasn't able to reproduce the problem, but in theory, it's possible that without this change, recognizers from RNGH and RCTSurfaceTouchHandler could run simultaneously, since this path never ran: https://github.com/software-mansion/react-native-gesture-handler/blob/5587435679eabe3f8690f077ba7c2ecc3e354a14/packages/react-native-gesture-handler/apple/RNRootViewGestureRecognizer.m#L55-L63
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
Current logic dedicated to handling
RNRootViewGestureRecognizeron iOS looks only for RN's native roots. When gestures are used inside Screens'FullWindowOverlay, the logic doesn't do anything, but the overlay has its ownRCTSurfaceTouchHandler.This PR updates the traversal logic so it handles
RNSFullWindowOverlayContainerthe same way asRCTSurfaceView.Test plan
I wasn't able to reproduce the problem, but in theory, it's possible that without this change, recognizers from RNGH and RCTSurfaceTouchHandler could run simultaneously, since this path never ran:
react-native-gesture-handler/packages/react-native-gesture-handler/apple/RNRootViewGestureRecognizer.m
Lines 55 to 63 in 5587435