Skip to content

Commit 2117a1c

Browse files
committed
[iOS] Handle FullWindowOverlay as the native root (#4039)
## 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
1 parent 788a823 commit 2117a1c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/react-native-gesture-handler/apple/RNGestureHandlerManager.mm

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,14 @@ - (void)registerViewWithGestureRecognizerAttachedIfNeeded:(RNGHUIView *)childVie
244244
RNGHUIView *touchHandlerView = childView;
245245

246246
#if !TARGET_OS_OSX
247+
Class fullWindowOverlayContainerClass = NSClassFromString(@"RNSFullWindowOverlayContainer");
248+
247249
if ([[childView reactViewController] isKindOfClass:[RCTFabricModalHostViewController class]]) {
248250
touchHandlerView = [childView reactViewController].view;
249251
} else {
250-
while (touchHandlerView != nil && ![touchHandlerView isKindOfClass:[RCTSurfaceView class]]) {
252+
while (
253+
touchHandlerView != nil && ![touchHandlerView isKindOfClass:[RCTSurfaceView class]] &&
254+
(fullWindowOverlayContainerClass == nil || ![touchHandlerView isKindOfClass:fullWindowOverlayContainerClass])) {
251255
touchHandlerView = touchHandlerView.superview;
252256
}
253257
}

0 commit comments

Comments
 (0)