[V4] Dynamic Snap points not working with React Navigation
See original GitHub issueBug
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 https://github.com/gorhom/react-native-bottom-sheet/discussions/427#discussioncomment-1158471_
Issue Analytics
- State:
- Created 2 years ago
- Reactions:6
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Troubleshooting | React Navigation
Troubleshooting. This section attempts to outline issues that users frequently encounter when first getting accustomed to using React Navigation.
Read more >Programmatically navigate using React router - Stack Overflow
With v4 of React Router, there are three approaches that you can take to programmatic routing within components. Use the withRouter higher-order ...
Read more >Props | React Native Bottom Sheet - GitHub Pages
Content height helps dynamic snap points calculation. type, default, required. number | Animated.SharedValue<number>, undefined, NO. containerOffset .
Read more >React Native carousel with react-native-snap-carousel
It has been fixed. Install “react-native-snap-carousel”: “^4.0.0-beta.6”. Version 3.6 is causing the issue.
Read more >React Native scrollToIndex - Dynamic size item scroll inside ...
In this video tutorial you will learn about React Native scrollToIndex and how to scroll to an item inside a FlatList, ListView, ScrollView, ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
try this
@thebiltheory: hello! 👋
This issue is being automatically closed because it does not follow the issue template.