Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/test-examples/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ import Test2028 from './src/Test2028';
import Test2048 from './src/Test2048';
import Test2069 from './src/Test2069';
import Test2118 from './src/Test2118';
import Test2184 from './src/Test2184';
import TestScreenAnimation from './src/TestScreenAnimation';

enableFreeze(true);
Expand Down
54 changes: 54 additions & 0 deletions apps/test-examples/src/Test2184.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import React, { useEffect } from 'react';
import { Button } from 'react-native';
import { NavigationContainer, ParamListBase } from '@react-navigation/native';
import {
createNativeStackNavigator,
NativeStackNavigationProp,
} from '@react-navigation/native-stack';

const Stack = createNativeStackNavigator();

export default function App() {
return (
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen name="First" component={First} />
<Stack.Screen
name="Second"
component={Second}
options={{ presentation: 'modal', gestureEnabled: false }}
/>
</Stack.Navigator>
</NavigationContainer>
);
}

type Props = {
navigation: NativeStackNavigationProp<ParamListBase>;
};

const First = ({ navigation }: Props): JSX.Element => {
return (
<Button
title="Tap me for second screen"
onPress={() => navigation.navigate('Second')}
/>
);
};

const Second = ({ navigation }: Props): JSX.Element => {
useEffect(() => {
const unsubscribe = navigation.addListener('gestureCancel', () => {
console.log('gestureCancel');
});

return unsubscribe;
}, [navigation]);

return (
<Button
title="Tap me for first screen"
onPress={() => navigation.goBack()}
/>
);
};
8 changes: 8 additions & 0 deletions ios/RNSScreen.mm
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,14 @@ - (void)notifyTransitionProgress:(double)progress closing:(BOOL)closing goingFor
#endif
}

#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \
__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
- (void)presentationControllerDidAttemptToDismiss:(UIPresentationController *)presentationController
{
[self notifyGestureCancel];
}
#endif

- (void)presentationControllerWillDismiss:(UIPresentationController *)presentationController
{
// We need to call both "cancel" and "reset" here because RN's gesture recognizer
Expand Down