[v4] | Example of BottomSheetModal does not work in iOS with Expo SDK 46
See original GitHub issueBug
The modal does not open on iOS, it does open sometimes if we add a console.log in handleSheetChanges it opens sometimes the first time but without animation.
In our real app we saw shadow visible at the bottom of the bottom sheet so it seems like it does not go to the right snappoint or something. When do a ui action the modal suddenly shows up.
Environment info
Library | Version |
---|---|
@gorhom/bottom-sheet | 4.4.0 |
react-native | 0.69.1 |
react-native-reanimated | 2.9.1 |
react-native-gesture-handler | 2.5.0 |
Steps To Reproduce
Use expo SDK 46
- Run on iOS
- Press open modal
- Modal does not open, only when you press a second time
Describe what you expected to happen:
- Press open modal
- Modal opens
Reproducible sample code
import "react-native-gesture-handler";
import React, { useCallback, useMemo, useRef } from "react";
import { View, Text, StyleSheet, Button } from "react-native";
import { BottomSheetModal, BottomSheetModalProvider } from "@gorhom/bottom-sheet";
import { GestureHandlerRootView } from "react-native-gesture-handler";
const App = () => {
// ref
const bottomSheetModalRef = useRef<BottomSheetModal>(null);
// variables
const snapPoints = useMemo(() => ["25%", "50%"], []);
// callbacks
const handlePresentModalPress = useCallback(() => {
bottomSheetModalRef.current?.present();
}, []);
const handleSheetChanges = useCallback((index: number) => {
// console.log("handleSheetChanges", index);
}, []);
// renders
return (
<View style={styles.container}>
<Button onPress={handlePresentModalPress} title="Present Modal" color="black" />
<BottomSheetModal ref={bottomSheetModalRef} index={1} snapPoints={snapPoints} onChange={handleSheetChanges}>
<View style={styles.contentContainer}>
<Text>Awesome 🎉</Text>
</View>
</BottomSheetModal>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
padding: 24,
justifyContent: "center",
backgroundColor: "grey",
},
contentContainer: {
flex: 1,
alignItems: "center",
},
});
export default () => {
return (
<BottomSheetModalProvider>
<GestureHandlerRootView style={{ flex: 1 }}>
<App />
</GestureHandlerRootView>
</BottomSheetModalProvider>
);
};
I can not use the versions I want in the snack it works but i cant upgrade deps there https://snack.expo.dev/@richardlindhout/bottom-sheet-v4-reproducible-issue-template
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:11
Top Results From Across the Web
Expo SDK 46. Today we're announcing the release of…
You'll be able to use expo build to build apps that use SDK 46 and earlier, but not apps that use SDK 47...
Read more >Expo: 'Withnavigation' & 'gorhom/bottom-sheet' is causing the ...
Our app is running fine on the development mode but the app build is getting stuck at the splash screen. To identify the...
Read more >Leandro Favre (@FavreLeandro) / Twitter
Expo is a game changer on React Native, and EAS is the best. Great thread! Quote Tweet.
Read more >Newest 'expo' Questions - Page 4 - Stack Overflow
I have an IOS react native app that uses expo-image-picker to get images from the Image Library and Camera. When testing the app...
Read more >Building Twitter Bottom Sheet with React Native - YouTube
Hey what's up guys, In this video we learn how to create a beautiful bottom sheet modal using React NativeReact Native Course ...
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 Free
Top 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
Problem and solution has already been described here. This issue occurs because of reanimated bug
What is very strange is that if i import enableLogging and call it enableLogging() it works great.