-
-
Notifications
You must be signed in to change notification settings - Fork 1k
[iOS] Fix onFinalize callbacks on iOS 26
#3855
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
j-piasecki
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.
How do these changes impact macOS?
| } | ||
|
|
||
| - (void)handleGesture:(UIGestureRecognizer *)recognizer | ||
| - (void)handleGesture:(UIGestureRecognizer *)recognizer fromReset:(BOOL)fromReset |
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.
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.
Should be fixed in afa3ffa.
It shouldn't break anything, I've compiled example app and checked some of the examples, along with provided test code. |
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. <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 In #3855 we've introduced `fromReset` argument for `handleGesture`. However, `ManualActivationRecognizer` does not have such signature. This PR removes it from selector as `fromReset` is not passed anyway. ## Test plan Check that on `Pressable` example app no longer crashes when clicking on **press retention** area.

Description
This PR aims to fix callback differences between
iOS26 and 18. Most of them were already resolved, but there were some issues withPanandonFinalizecallback.Calling
resethas been removed fromTapas it is called automatically by recognizer and leaving it resulted in double callbacks.Note
For related changes, see #3740, #3756 and #3849.
Test plan
Tested on the following code: