-
-
Notifications
You must be signed in to change notification settings - Fork 1k
[iOS] Fix pan not triggering onFinalize when blocked
#3849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
m-bert
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like it doesn't work on iOS 26 😞
26
Nagranie.z.ekranu.2025-11-28.o.20.22.37.mov
18.5
Nagranie.z.ekranu.2025-11-28.o.20.23.42.mov
|
@m-bert It seems like the iOS 26 bug is unrelated to this change. Do you think this one can be merged, or do you prefer both to be fixed in one go? |
m-bert
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@m-bert It seems like the iOS 26 bug is unrelated to this change. Do you think this one can be merged, or do you prefer both to be fixed in one go?
Seems like it is. Sice this is a one-liner we can merge that and I'll look into 26.0 bug later 😅
## Description This PR aims to fix callback differences between `iOS` 26 and 18. Most of them were already resolved, but there were some issues with `Pan` and `onFinalize` callback. Calling `reset` has been removed from `Tap` as it is called automatically by recognizer and leaving it resulted in double callbacks. > [!NOTE] > For related changes, see #3740, #3756 and #3849. ## Test plan <details> <summary>Tested on the following code:</summary> ```tsx import { StyleSheet, View, Text } from 'react-native'; import { GestureHandlerRootView, Gesture, GestureDetector, GestureType, } from 'react-native-gesture-handler'; function TestBox({ gestureType, bgColor, }: { gestureType: GestureType; bgColor: string; }) { const handlerName = gestureType.handlerName; const gesture = gestureType .onBegin(() => { console.log(`[${handlerName}] onBegin`); }) .onEnd((_e, s) => { console.log(`[${handlerName}] onEnd (${s})`); }) .onFinalize((_e, s) => { console.log(`[${handlerName}] onFinalize (${s})`); }) .runOnJS(true); try { // @ts-ignore this is exactly why we have the try-catch block gesture.onUpdate(() => { console.log(`[${handlerName}] onUpdate`); }); } catch { /* empty */ } return ( <View style={styles.center}> <Text>{handlerName}</Text> <GestureDetector gesture={gesture}> <View style={[styles.box, { backgroundColor: bgColor }]} /> </GestureDetector> </View> ); } export default function App() { return ( <GestureHandlerRootView style={[{ flex: 1, padding: 50 }, styles.center]}> <TestBox gestureType={Gesture.Pan()} bgColor="#b58df1" /> <TestBox gestureType={Gesture.LongPress()} bgColor="#f1a85d" /> <TestBox gestureType={Gesture.Fling()} bgColor="#5df1a8" /> <TestBox gestureType={Gesture.Tap()} bgColor="#5d8ef1" /> </GestureHandlerRootView> ); } const styles = StyleSheet.create({ center: { display: 'flex', justifyContent: 'space-around', alignItems: 'center', }, box: { height: 100, width: 100, backgroundColor: '#b58df1', borderRadius: 20, marginBottom: 30, }, }); ``` </details>
Description
I noticed that #3756 restored calling
triggerActionto all gestures that were affected by #3740, but not to Pan. This is causing Pan to triggeronBeginwithout then triggeringonFinalize.This PR restores calling
triggerActioninreset.Test plan