Skip to content

[iOS] Handle FullWindowOverlay as the native root#4039

Merged
j-piasecki merged 2 commits intomainfrom
@jpiasecki/handle-full-window-overlay-root
Mar 27, 2026
Merged

[iOS] Handle FullWindowOverlay as the native root#4039
j-piasecki merged 2 commits intomainfrom
@jpiasecki/handle-full-window-overlay-root

Conversation

@j-piasecki
Copy link
Member

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.

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:

// When this method is called it means that one of handlers has activated, in this case we want
// to send an info to JS so that it cancells all JS responders, as long as the preventing
// recognizer is from Gesture Handler, otherwise we might break some interactions
RNGestureHandler *handler = [RNGestureHandler findGestureHandlerByRecognizer:preventingGestureRecognizer];
if (handler != nil) {
[self.delegate gestureRecognizer:preventingGestureRecognizer didActivateInViewWithTouchHandler:self.view];
}
return [super canBePreventedByGestureRecognizer:preventingGestureRecognizer];

Copilot AI review requested due to automatic review settings March 26, 2026 10:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 RNSFullWindowOverlayContainer via NSClassFromString.
  • Extends the superview traversal stop-condition to stop at either RCTSurfaceView or RNSFullWindowOverlayContainer.

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

Copy link
Member

@WoLewicki WoLewicki left a comment

Choose a reason for hiding this comment

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

lgtm

@j-piasecki j-piasecki merged commit 6c06cc4 into main Mar 27, 2026
3 checks passed
@j-piasecki j-piasecki deleted the @jpiasecki/handle-full-window-overlay-root branch March 27, 2026 10:27
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
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