software-mansion / software-mansion/react-native-screens

Form Sheet does not react to updated `sheetAllowedDetents` values (Android only)

Open
#3,919 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

platform:android repro-provided
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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.