Open
Description
Bug
Environment info
Library | Version |
---|---|
@gorhom/bottom-sheet | 4.0.0-alpha.30 |
react-native | expo sdk-42.0.0 |
react-native-reanimated | 2.2.0 |
react-native-gesture-handler | 1.10.2 |
react-native-gesture-handler | 1.10.2 |
@react-navigation/drawer | 6.1.0 |
@react-navigation/native | 6.0.2 |
@react-navigation/native-stack | 6.1.0 |
@react-navigation/stack | 6.0.3 |
Steps To Reproduce
Example Snack: https://snack.expo.dev/@thebiltheory/bottom-sheet-v4-with-react-navigation
- Implement dynamic snap points example
- Implement a navigator
Describe what you expected to happen:
- For the bottom sheet to dynamically take an appropriate height based on the content in each screen.
- For the bottom sheet to have a minimum height while a "loader" is being shown
Reproducible sample code
Example Snack: https://snack.expo.dev/@thebiltheory/bottom-sheet-v4-with-react-navigation
const {
animatedHandleHeight,
animatedSnapPoints,
animatedContentHeight,
handleContentLayout,
} = useBottomSheetDynamicSnapPoints(["CONTENT_HEIGHT"]);
<NativeViewGestureHandler disallowInterruption={true}>
<View flex={1}>
<BottomSheetModal
name="Select"
ref={newBookingModal.ref}
onDismiss={resetCarForm}
snapPoints={animatedSnapPoints}
handleHeight={animatedHandleHeight}
contentHeight={animatedContentHeight}
enablePanDownToClose={true}
keyboardBehavior="interactive"
android_keyboardInputMode="adjustPan"
>
<BottomSheetScrollView
onLayout={handleContentLayout}
style={{
flex: 1,
backgroundColor: "red",
}}
>
<NewBookingNavigator />
</BottomSheetScrollView>
</BottomSheetModal>
</View>
</NativeViewGestureHandler>
NewBookingNavigator.ts
<NavigationContainer independent={true}>
<Stack.Navigator
screenOptions={screenOptions}
initialRouteName="ScreenOne"
>
<Stack.Screen
name="ScreenOne"
options={{ title: "Screen One", headerShown: false }}
component={ScreenOne}
/>
<Stack.Screen
name="ScreenTwo"
options={{ title: "Screen Two", headerShown: false }}
component={ScreenTwo}
/>
...
</Stack.Navigator>
</NavigationContainer>
Originally posted by @thebiltheory in #427 (comment)