software-mansion / software-mansion/react-native-screens
Form Sheet does not react to updated `sheetAllowedDetents` values (Android only)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 3.7k
- Forks
- 714
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 71
Description
Description
On Android, when using setOptions to change sheetAllowedDetents, the sheet does not snap to new positions automatically, unlike how it does on iOS.
In my actual use case, the first detent is dynamically calculated based on layout metrics of parts of the content inside the sheet, and there doesn't seem to be a way to make it update the current position on Android.
| Android | iOS |
|---|---|
Steps to reproduce
import { Button, View } from 'react-native';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { NavigationContainer } 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 = ({ navigation }) => (
<View style={{ padding: 24 }}>
<Button
title="Change detent"
onPress={() => {
navigation.setOptions({ sheetAllowedDetents: [Math.random() * 0.75 + 0.25] });
}}
/>
</View>
);
const App = () => (
<SafeAreaProvider>
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen name="Home" component={HomeScreen} />
<Stack.Screen
name="Sheet"
component={SheetScreen}
options={{ presentation: 'formSheet', sheetAllowedDetents: [0.5] }}
/>
</Stack.Navigator>
</NavigationContainer>
</SafeAreaProvider>
);
export default App;
Snack or a link to a repository
https://github.com/SimpleCreations/SEE_REPRO_ABOVE_sorry_bot
Screens version
4.24.0
React Native version
0.85.2
Platforms
Android
JavaScript runtime
Hermes
Workflow
React Native (without Expo)
Architecture
Fabric (New Architecture)
Build type
Debug mode
Device
Android emulator
Device model
No response
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.
Research direction
Start with the linked reproduction and trace the Android handling of setOptions updates for sheetAllowedDetents, comparing it with the working iOS behavior. Done means changing the detent on Android causes the open form sheet to snap to the new position, matching the reported reproduction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, react-native, typescript
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100