software-mansion / software-mansion/react-native-screens
[Android] `usePreventRemove` doesn't prevent `formSheet`s from being dismissed with gestures
Open
@t0maboro is already working on this.
Since Jul 15, 2026.
platform:android
repro-provided
- Dominant language
- TypeScript
- Stars
- 3.7k
- Forks
- 713
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 71
Description
Description
When usePreventRemove(true) is used in a formSheet screen:
- On Android:
- Tapping on a form sheet's backdrop does not dismiss the sheet, but an error appears in the console.
- Swiping down to dismiss still dismisses the sheet, and in addition, the app becomes unresponsive, and an error appears in the console.
- The error message is:
The screen 'Sheet' was removed natively but didn't get removed from JS state. This can happen if the action was prevented in a. 'beforeRemove' listener, which is not fully supported in native-stack. Consider using a 'usePreventRemove' hook with 'headerBackButtonMenuEnabled: false' to prevent users from natively going back multiple screens.
- On iOS:
- Everything works as expected: the sheet cannot be dismissed and no errors appear in the console.
| Android | iOS |
|---|---|
Note: sadly, currently there doesn't seem to be a way to display a persistent bottom sheet on Android:
gestureEnabledis only implemented for iOS;- a
preventDefaultcall inside abeforeRemovelistener has no effect; usePreventRemovedoesn't hadle all cases and produces errors.
Steps to reproduce
import { Button, Text, View } from 'react-native';
import { NavigationContainer, usePreventRemove } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
const Stack = createNativeStackNavigator();
const HomeScreen = ({ navigation }) => (
<Button
title="Open form sheet"
onPress={() => navigation.navigate('Sheet')}
/>
);
const SheetScreen = () => {
usePreventRemove(true, () => {});
return (
<View style={{ padding: 24 }}>
<Text>Form sheet</Text>
</View>
);
};
const App = () => (
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen name="Home" component={HomeScreen} />
<Stack.Screen
name="Sheet"
component={SheetScreen}
options={{ presentation: 'formSheet', sheetAllowedDetents: [0.5] }}
/>
</Stack.Navigator>
</NavigationContainer>
);
export default App;
"dependencies": {
"@react-navigation/native": "7.3.8",
"@react-navigation/native-stack": "7.17.10",
"react": "19.2.3",
"react-native": "0.86.0",
"react-native-screens": "4.26.0"
}
- Run the repro on Android
- Tap "Open form sheet"
- Tap on the backdrop
- Observe the unexpected error in the console
- Reload the app
- Swipe the sheet down
- Observe that the sheet wasn't prevented from being dismissed
- Observe the unexpected error in the console
- Observe that the app does not respond to touches anymore
Snack or a link to a repository
https://github.com/SimpleCreations/SEE_REPRO_ABOVE_sorry_bot
Screens version
4.26.0
React Native version
0.86.0
Platforms
Android
JavaScript runtime
Hermes
Workflow
React Native (without Expo)
Architecture
Fabric (New Architecture)
Build type
Debug mode
Device
Android emulator
Device model
Android 16 emulator
Acknowledgements
Yes
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.