From fefa51c1880e0cccadbe2a1af50e0c3a8fddc8db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82?= Date: Thu, 6 Aug 2026 09:50:33 +0200 Subject: [PATCH 1/2] Send touch events on VirtualDetectors --- .../apple/RNGestureHandler.mm | 2 +- .../apple/RNGestureHandlerPointerTracker.mm | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/react-native-gesture-handler/apple/RNGestureHandler.mm b/packages/react-native-gesture-handler/apple/RNGestureHandler.mm index 12e64fe14f..065090a82a 100644 --- a/packages/react-native-gesture-handler/apple/RNGestureHandler.mm +++ b/packages/react-native-gesture-handler/apple/RNGestureHandler.mm @@ -596,7 +596,7 @@ - (void)sendEvent:(RNGestureHandlerStateChange *)event - (void)sendTouchEventInState:(RNGestureHandlerState)state forViewWithTag:(NSNumber *)reactTag { - if (_actionType == RNGestureHandlerActionTypeNativeDetector) { + if ([self usesNativeOrVirtualDetector]) { [self.emitter sendNativeTouchEventForGestureHandler:self withPointerType:_pointerType forHandlerType:[self eventHandlerType]]; diff --git a/packages/react-native-gesture-handler/apple/RNGestureHandlerPointerTracker.mm b/packages/react-native-gesture-handler/apple/RNGestureHandlerPointerTracker.mm index 2f06e15dbc..72120f1515 100644 --- a/packages/react-native-gesture-handler/apple/RNGestureHandlerPointerTracker.mm +++ b/packages/react-native-gesture-handler/apple/RNGestureHandlerPointerTracker.mm @@ -267,9 +267,11 @@ - (void)sendEvent // it may happen that the gesture recognizer is reset after it's been unbound from the view, // it that recognizer tried to send event, the app would crash because the target of the event - // would be nil. - if (_gestureHandler.recognizer.view.reactTag == nil && - _gestureHandler.actionType != RNGestureHandlerActionTypeNativeDetector) { + // would be nil. Detector-attached handlers (native and virtual alike) don't route events by + // the view's reactTag — they dispatch through the detector view — so a nil tag is not an + // obstacle for them. The virtual recognizer's view has no reactTag at all, so without this + // exemption virtual handlers would never deliver touch events. + if (_gestureHandler.recognizer.view.reactTag == nil && ![_gestureHandler usesNativeOrVirtualDetector]) { return; } From 9998d5ba247e5a68200c966dde886dd97c48e0c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Bert?= <63123542+m-bert@users.noreply.github.com> Date: Thu, 6 Aug 2026 10:56:49 +0200 Subject: [PATCH 2/2] comment Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .../apple/RNGestureHandlerPointerTracker.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native-gesture-handler/apple/RNGestureHandlerPointerTracker.mm b/packages/react-native-gesture-handler/apple/RNGestureHandlerPointerTracker.mm index 72120f1515..cf0003d5fb 100644 --- a/packages/react-native-gesture-handler/apple/RNGestureHandlerPointerTracker.mm +++ b/packages/react-native-gesture-handler/apple/RNGestureHandlerPointerTracker.mm @@ -266,7 +266,7 @@ - (void)sendEvent } // it may happen that the gesture recognizer is reset after it's been unbound from the view, - // it that recognizer tried to send event, the app would crash because the target of the event + // if that recognizer tried to send an event, the app would crash because the target of the event // would be nil. Detector-attached handlers (native and virtual alike) don't route events by // the view's reactTag — they dispatch through the detector view — so a nil tag is not an // obstacle for them. The virtual recognizer's view has no reactTag at all, so without this