From 046d21607715983fd3ed83bd6b3f2fd742927b3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82?= Date: Tue, 7 Oct 2025 17:44:07 +0200 Subject: [PATCH 1/6] Fix Pan --- .../apple/Handlers/RNPanHandler.m | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/react-native-gesture-handler/apple/Handlers/RNPanHandler.m b/packages/react-native-gesture-handler/apple/Handlers/RNPanHandler.m index 8b8c4bdc1b..90d0db2d1a 100644 --- a/packages/react-native-gesture-handler/apple/Handlers/RNPanHandler.m +++ b/packages/react-native-gesture-handler/apple/Handlers/RNPanHandler.m @@ -243,19 +243,30 @@ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesEnded:touches withEvent:event]; [self interactionsEnded:touches withEvent:event]; + + if (@available(iOS 26.0, *)) { + [self triggerAction]; + } } - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesCancelled:touches withEvent:event]; [self interactionsCancelled:touches withEvent:event]; + + if (@available(iOS 26.0, *)) { + [self triggerAction]; + } } #endif - (void)reset { - [self triggerAction]; + if (!(@available(iOS 26.0, *))) { + [self triggerAction]; + } + [_gestureHandler.pointerTracker reset]; [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(activateAfterLongPress) object:nil]; self.enabled = YES; From fc179b7ac36a281936d71d13d83271bcf4cdb292 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82?= Date: Tue, 7 Oct 2025 18:03:40 +0200 Subject: [PATCH 2/6] Fix Fling --- .../apple/Handlers/RNFlingHandler.m | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/react-native-gesture-handler/apple/Handlers/RNFlingHandler.m b/packages/react-native-gesture-handler/apple/Handlers/RNFlingHandler.m index 554aba88e4..6e55012b20 100644 --- a/packages/react-native-gesture-handler/apple/Handlers/RNFlingHandler.m +++ b/packages/react-native-gesture-handler/apple/Handlers/RNFlingHandler.m @@ -53,6 +53,10 @@ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event _lastPoint = [[[touches allObjects] objectAtIndex:0] locationInView:_gestureHandler.recognizer.view]; [super touchesEnded:touches withEvent:event]; [_gestureHandler.pointerTracker touchesEnded:touches withEvent:event]; + + if (@available(iOS 26.0, *)) { + [self triggerAction]; + } } - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event @@ -60,6 +64,10 @@ - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)ev _lastPoint = [[[touches allObjects] objectAtIndex:0] locationInView:_gestureHandler.recognizer.view]; [super touchesCancelled:touches withEvent:event]; [_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event]; + + if (@available(iOS 26.0, *)) { + [self triggerAction]; + } } - (void)triggerAction @@ -69,7 +77,10 @@ - (void)triggerAction - (void)reset { - [self triggerAction]; + if (!(@available(iOS 26.0, *))) { + [self triggerAction]; + } + [_gestureHandler.pointerTracker reset]; _hasBegan = NO; [super reset]; From 2d5c200214a184fe5a95bcd7f2c4e574b640c0dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82?= Date: Tue, 7 Oct 2025 18:03:54 +0200 Subject: [PATCH 3/6] Fix LongPress --- .../apple/Handlers/RNLongPressHandler.m | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/react-native-gesture-handler/apple/Handlers/RNLongPressHandler.m b/packages/react-native-gesture-handler/apple/Handlers/RNLongPressHandler.m index 23b2613089..09cbe43b00 100644 --- a/packages/react-native-gesture-handler/apple/Handlers/RNLongPressHandler.m +++ b/packages/react-native-gesture-handler/apple/Handlers/RNLongPressHandler.m @@ -102,12 +102,20 @@ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesEnded:touches withEvent:event]; [_gestureHandler.pointerTracker touchesEnded:touches withEvent:event]; + + if ((@available(iOS 26.0, *)) && self.state == UIGestureRecognizerStateFailed) { + [self triggerAction]; + } } - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesCancelled:touches withEvent:event]; [_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event]; + + if ((@available(iOS 26.0, *)) && self.state == UIGestureRecognizerStateFailed) { + [self triggerAction]; + } } #else @@ -181,7 +189,7 @@ - (BOOL)shouldCancelGesture - (void)reset { - if (self.state == UIGestureRecognizerStateFailed) { + if (!(@available(iOS 26.0, *)) && self.state == UIGestureRecognizerStateFailed) { [self triggerAction]; } From 8d30a0815262d565bf6b21318919b01e3a62ffc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82?= Date: Tue, 7 Oct 2025 18:09:11 +0200 Subject: [PATCH 4/6] Fix Tap --- .../apple/Handlers/RNTapHandler.m | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/react-native-gesture-handler/apple/Handlers/RNTapHandler.m b/packages/react-native-gesture-handler/apple/Handlers/RNTapHandler.m index d10c05a5ef..93f5e64bd1 100644 --- a/packages/react-native-gesture-handler/apple/Handlers/RNTapHandler.m +++ b/packages/react-native-gesture-handler/apple/Handlers/RNTapHandler.m @@ -200,12 +200,20 @@ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesEnded:touches withEvent:event]; [self interactionsEnded:touches withEvent:event]; + + if (@available(iOS 26.0, *) && self.state == UIGestureRecognizerStateFailed) { + [self triggerAction]; + } } - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesCancelled:touches withEvent:event]; [self interactionsCancelled:touches withEvent:event]; + + if (@available(iOS 26.0, *) && self.state == UIGestureRecognizerStateFailed) { + [self triggerAction]; + } } #endif @@ -243,9 +251,10 @@ - (BOOL)shouldFailUnderCustomCriteria - (void)reset { - if (self.state == UIGestureRecognizerStateFailed) { + if (!(@available(iOS 26.0, *)) && self.state == UIGestureRecognizerStateFailed) { [self triggerAction]; } + [_gestureHandler.pointerTracker reset]; [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(cancel) object:nil]; From 2573a301decba210e7b90a1244f998b2c1225a73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82?= Date: Wed, 8 Oct 2025 17:25:43 +0200 Subject: [PATCH 5/6] Introduce iOS_VERSION macro --- .../apple/Handlers/RNFlingHandler.m | 10 +++++++--- .../apple/Handlers/RNLongPressHandler.m | 10 +++++++--- .../apple/Handlers/RNPanHandler.m | 10 +++++++--- .../apple/Handlers/RNTapHandler.m | 10 +++++++--- .../react-native-gesture-handler/apple/RNGHUIKit.h | 2 ++ 5 files changed, 30 insertions(+), 12 deletions(-) diff --git a/packages/react-native-gesture-handler/apple/Handlers/RNFlingHandler.m b/packages/react-native-gesture-handler/apple/Handlers/RNFlingHandler.m index 6e55012b20..fd5f91c2aa 100644 --- a/packages/react-native-gesture-handler/apple/Handlers/RNFlingHandler.m +++ b/packages/react-native-gesture-handler/apple/Handlers/RNFlingHandler.m @@ -54,7 +54,7 @@ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event [super touchesEnded:touches withEvent:event]; [_gestureHandler.pointerTracker touchesEnded:touches withEvent:event]; - if (@available(iOS 26.0, *)) { + if (iOS_VERSION >= 26.0) { [self triggerAction]; } } @@ -65,7 +65,7 @@ - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)ev [super touchesCancelled:touches withEvent:event]; [_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event]; - if (@available(iOS 26.0, *)) { + if (iOS_VERSION >= 26.0) { [self triggerAction]; } } @@ -77,9 +77,13 @@ - (void)triggerAction - (void)reset { - if (!(@available(iOS 26.0, *))) { +#if TARGET_OS_IOS + if (iOS_VERSION < 26.0) { [self triggerAction]; } +#else + [self triggerAction]; +#endif [_gestureHandler.pointerTracker reset]; _hasBegan = NO; diff --git a/packages/react-native-gesture-handler/apple/Handlers/RNLongPressHandler.m b/packages/react-native-gesture-handler/apple/Handlers/RNLongPressHandler.m index 09cbe43b00..0c900e4423 100644 --- a/packages/react-native-gesture-handler/apple/Handlers/RNLongPressHandler.m +++ b/packages/react-native-gesture-handler/apple/Handlers/RNLongPressHandler.m @@ -103,7 +103,7 @@ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event [super touchesEnded:touches withEvent:event]; [_gestureHandler.pointerTracker touchesEnded:touches withEvent:event]; - if ((@available(iOS 26.0, *)) && self.state == UIGestureRecognizerStateFailed) { + if (iOS_VERSION >= 26.0 && self.state == UIGestureRecognizerStateFailed) { [self triggerAction]; } } @@ -113,7 +113,7 @@ - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)ev [super touchesCancelled:touches withEvent:event]; [_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event]; - if ((@available(iOS 26.0, *)) && self.state == UIGestureRecognizerStateFailed) { + if (iOS_VERSION >= 26.0 && self.state == UIGestureRecognizerStateFailed) { [self triggerAction]; } } @@ -189,9 +189,13 @@ - (BOOL)shouldCancelGesture - (void)reset { - if (!(@available(iOS 26.0, *)) && self.state == UIGestureRecognizerStateFailed) { +#if TARGET_OS_IOS + if (iOS_VERSION < 26.0 && self.state == UIGestureRecognizerStateFailed) { [self triggerAction]; } +#else + [self triggerAction]; +#endif [_gestureHandler.pointerTracker reset]; diff --git a/packages/react-native-gesture-handler/apple/Handlers/RNPanHandler.m b/packages/react-native-gesture-handler/apple/Handlers/RNPanHandler.m index 90d0db2d1a..0215da21ac 100644 --- a/packages/react-native-gesture-handler/apple/Handlers/RNPanHandler.m +++ b/packages/react-native-gesture-handler/apple/Handlers/RNPanHandler.m @@ -244,7 +244,7 @@ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event [super touchesEnded:touches withEvent:event]; [self interactionsEnded:touches withEvent:event]; - if (@available(iOS 26.0, *)) { + if (iOS_VERSION >= 26.0) { [self triggerAction]; } } @@ -254,7 +254,7 @@ - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)ev [super touchesCancelled:touches withEvent:event]; [self interactionsCancelled:touches withEvent:event]; - if (@available(iOS 26.0, *)) { + if (iOS_VERSION >= 26.0) { [self triggerAction]; } } @@ -263,9 +263,13 @@ - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)ev - (void)reset { - if (!(@available(iOS 26.0, *))) { +#if TARGET_OS_IOS + if (iOS_VERSION < 26.0) { [self triggerAction]; } +#else + [self triggerAction]; +#endif [_gestureHandler.pointerTracker reset]; [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(activateAfterLongPress) object:nil]; diff --git a/packages/react-native-gesture-handler/apple/Handlers/RNTapHandler.m b/packages/react-native-gesture-handler/apple/Handlers/RNTapHandler.m index 93f5e64bd1..9aee1905c8 100644 --- a/packages/react-native-gesture-handler/apple/Handlers/RNTapHandler.m +++ b/packages/react-native-gesture-handler/apple/Handlers/RNTapHandler.m @@ -201,7 +201,7 @@ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event [super touchesEnded:touches withEvent:event]; [self interactionsEnded:touches withEvent:event]; - if (@available(iOS 26.0, *) && self.state == UIGestureRecognizerStateFailed) { + if (iOS_VERSION >= 26.0 && self.state == UIGestureRecognizerStateFailed) { [self triggerAction]; } } @@ -211,7 +211,7 @@ - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)ev [super touchesCancelled:touches withEvent:event]; [self interactionsCancelled:touches withEvent:event]; - if (@available(iOS 26.0, *) && self.state == UIGestureRecognizerStateFailed) { + if (iOS_VERSION >= 26.0 && self.state == UIGestureRecognizerStateFailed) { [self triggerAction]; } } @@ -251,9 +251,13 @@ - (BOOL)shouldFailUnderCustomCriteria - (void)reset { - if (!(@available(iOS 26.0, *)) && self.state == UIGestureRecognizerStateFailed) { +#if TARGET_OS_IOS + if (iOS_VERSION < 26.0 && self.state == UIGestureRecognizerStateFailed) { [self triggerAction]; } +#else + [self triggerAction]; +#endif [_gestureHandler.pointerTracker reset]; diff --git a/packages/react-native-gesture-handler/apple/RNGHUIKit.h b/packages/react-native-gesture-handler/apple/RNGHUIKit.h index dc0b742ca2..c3b1baf39e 100644 --- a/packages/react-native-gesture-handler/apple/RNGHUIKit.h +++ b/packages/react-native-gesture-handler/apple/RNGHUIKit.h @@ -12,6 +12,8 @@ typedef UIScrollView RNGHUIScrollView; #define RNGHGestureRecognizerStateBegan UIGestureRecognizerStateBegan; #define RNGHGestureRecognizerStateEnded UIGestureRecognizerStateEnded; +#define iOS_VERSION [[[UIDevice currentDevice] systemVersion] floatValue] + #else // TARGET_OS_OSX [ #import From 4213825d8da38518261206cfe6087a0a3d95a7dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82?= Date: Thu, 9 Oct 2025 15:51:48 +0200 Subject: [PATCH 6/6] Remove triggerAction from reset --- .../apple/Handlers/RNFlingHandler.m | 16 ++------------- .../apple/Handlers/RNLongPressHandler.m | 16 ++------------- .../apple/Handlers/RNPanHandler.m | 18 ++++------------- .../apple/Handlers/RNTapHandler.m | 20 ++++++------------- .../apple/RNGHUIKit.h | 2 -- 5 files changed, 14 insertions(+), 58 deletions(-) diff --git a/packages/react-native-gesture-handler/apple/Handlers/RNFlingHandler.m b/packages/react-native-gesture-handler/apple/Handlers/RNFlingHandler.m index fd5f91c2aa..79cf28511c 100644 --- a/packages/react-native-gesture-handler/apple/Handlers/RNFlingHandler.m +++ b/packages/react-native-gesture-handler/apple/Handlers/RNFlingHandler.m @@ -54,9 +54,7 @@ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event [super touchesEnded:touches withEvent:event]; [_gestureHandler.pointerTracker touchesEnded:touches withEvent:event]; - if (iOS_VERSION >= 26.0) { - [self triggerAction]; - } + [self triggerAction]; } - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event @@ -65,9 +63,7 @@ - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)ev [super touchesCancelled:touches withEvent:event]; [_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event]; - if (iOS_VERSION >= 26.0) { - [self triggerAction]; - } + [self triggerAction]; } - (void)triggerAction @@ -77,14 +73,6 @@ - (void)triggerAction - (void)reset { -#if TARGET_OS_IOS - if (iOS_VERSION < 26.0) { - [self triggerAction]; - } -#else - [self triggerAction]; -#endif - [_gestureHandler.pointerTracker reset]; _hasBegan = NO; [super reset]; diff --git a/packages/react-native-gesture-handler/apple/Handlers/RNLongPressHandler.m b/packages/react-native-gesture-handler/apple/Handlers/RNLongPressHandler.m index 0c900e4423..f4b1e5cfed 100644 --- a/packages/react-native-gesture-handler/apple/Handlers/RNLongPressHandler.m +++ b/packages/react-native-gesture-handler/apple/Handlers/RNLongPressHandler.m @@ -103,9 +103,7 @@ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event [super touchesEnded:touches withEvent:event]; [_gestureHandler.pointerTracker touchesEnded:touches withEvent:event]; - if (iOS_VERSION >= 26.0 && self.state == UIGestureRecognizerStateFailed) { - [self triggerAction]; - } + [self triggerAction]; } - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event @@ -113,9 +111,7 @@ - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)ev [super touchesCancelled:touches withEvent:event]; [_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event]; - if (iOS_VERSION >= 26.0 && self.state == UIGestureRecognizerStateFailed) { - [self triggerAction]; - } + [self triggerAction]; } #else @@ -189,14 +185,6 @@ - (BOOL)shouldCancelGesture - (void)reset { -#if TARGET_OS_IOS - if (iOS_VERSION < 26.0 && self.state == UIGestureRecognizerStateFailed) { - [self triggerAction]; - } -#else - [self triggerAction]; -#endif - [_gestureHandler.pointerTracker reset]; [super reset]; diff --git a/packages/react-native-gesture-handler/apple/Handlers/RNPanHandler.m b/packages/react-native-gesture-handler/apple/Handlers/RNPanHandler.m index 0215da21ac..594921b72d 100644 --- a/packages/react-native-gesture-handler/apple/Handlers/RNPanHandler.m +++ b/packages/react-native-gesture-handler/apple/Handlers/RNPanHandler.m @@ -165,6 +165,8 @@ - (void)interactionsMoved:(NSSet *)touches withEvent:(UIEvent *)event // UIGestureRecognizerStateFailed here. Making the behavior explicit. self.state = (self.state == UIGestureRecognizerStatePossible) ? UIGestureRecognizerStateFailed : UIGestureRecognizerStateCancelled; + + [self triggerAction]; [self reset]; return; } @@ -244,9 +246,7 @@ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event [super touchesEnded:touches withEvent:event]; [self interactionsEnded:touches withEvent:event]; - if (iOS_VERSION >= 26.0) { - [self triggerAction]; - } + [self triggerAction]; } - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event @@ -254,23 +254,13 @@ - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)ev [super touchesCancelled:touches withEvent:event]; [self interactionsCancelled:touches withEvent:event]; - if (iOS_VERSION >= 26.0) { - [self triggerAction]; - } + [self triggerAction]; } #endif - (void)reset { -#if TARGET_OS_IOS - if (iOS_VERSION < 26.0) { - [self triggerAction]; - } -#else - [self triggerAction]; -#endif - [_gestureHandler.pointerTracker reset]; [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(activateAfterLongPress) object:nil]; self.enabled = YES; diff --git a/packages/react-native-gesture-handler/apple/Handlers/RNTapHandler.m b/packages/react-native-gesture-handler/apple/Handlers/RNTapHandler.m index 9aee1905c8..da0b14aa2c 100644 --- a/packages/react-native-gesture-handler/apple/Handlers/RNTapHandler.m +++ b/packages/react-native-gesture-handler/apple/Handlers/RNTapHandler.m @@ -131,6 +131,8 @@ - (void)interactionsEnded:(NSSet *)touches withEvent:(UIEvent *)event if (_numberOfTaps == _tapsSoFar && _maxNumberOfTouches >= _minPointers) { self.state = UIGestureRecognizerStateEnded; + + [self triggerAction]; [self reset]; } else { [self performSelector:@selector(cancel) withObject:nil afterDelay:_maxDelay]; @@ -141,6 +143,8 @@ - (void)interactionsCancelled:(NSSet *)touches withEvent:(UIEvent *)event { [_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event]; self.state = UIGestureRecognizerStateCancelled; + + [self triggerAction]; [self reset]; } @@ -201,9 +205,7 @@ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event [super touchesEnded:touches withEvent:event]; [self interactionsEnded:touches withEvent:event]; - if (iOS_VERSION >= 26.0 && self.state == UIGestureRecognizerStateFailed) { - [self triggerAction]; - } + [self triggerAction]; } - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event @@ -211,9 +213,7 @@ - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)ev [super touchesCancelled:touches withEvent:event]; [self interactionsCancelled:touches withEvent:event]; - if (iOS_VERSION >= 26.0 && self.state == UIGestureRecognizerStateFailed) { - [self triggerAction]; - } + [self triggerAction]; } #endif @@ -251,14 +251,6 @@ - (BOOL)shouldFailUnderCustomCriteria - (void)reset { -#if TARGET_OS_IOS - if (iOS_VERSION < 26.0 && self.state == UIGestureRecognizerStateFailed) { - [self triggerAction]; - } -#else - [self triggerAction]; -#endif - [_gestureHandler.pointerTracker reset]; [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(cancel) object:nil]; diff --git a/packages/react-native-gesture-handler/apple/RNGHUIKit.h b/packages/react-native-gesture-handler/apple/RNGHUIKit.h index c3b1baf39e..dc0b742ca2 100644 --- a/packages/react-native-gesture-handler/apple/RNGHUIKit.h +++ b/packages/react-native-gesture-handler/apple/RNGHUIKit.h @@ -12,8 +12,6 @@ typedef UIScrollView RNGHUIScrollView; #define RNGHGestureRecognizerStateBegan UIGestureRecognizerStateBegan; #define RNGHGestureRecognizerStateEnded UIGestureRecognizerStateEnded; -#define iOS_VERSION [[[UIDevice currentDevice] systemVersion] floatValue] - #else // TARGET_OS_OSX [ #import