You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was just wondering how I can go about contributing to the react-native-bottom-sheet docs? Is there a public repo which contain the code for the docs website?
What brings me here is today I had trouble getting the quick start example to work on Android, but figured out a fix, and thought maybe I should contribute my fix to the docs so others don't run into the same issue.
For reference here is my fix for Android (involves adding gestureHandlerRootHOC wrapper to fix Android issue where BottomSheet does not respond to gestures to close the sheet):
import React, { useCallback, useMemo, useRef } from 'react';
import { View, Text, StyleSheet, Button, SafeAreaView } from 'react-native';
import BottomSheet from '@gorhom/bottom-sheet';
import { gestureHandlerRootHOC } from 'react-native-gesture-handler';
const App = () => {
// ref
const bottomSheetRef = useRef(null);
// variables
const snapPoints = useMemo(() => ['25%', '50%'], []);
// callbacks
const handleSheetChanges = useCallback((index) => {
console.log('handleSheetChanges', index);
}, []);
function handleButtonPress() {
bottomSheetRef.current.close();
}
// renders
return (
<View style={styles.container}>
<BottomSheet
ref={bottomSheetRef}
index={1}
snapPoints={snapPoints}
onChange={handleSheetChanges}
enablePanDownToClose={true}
>
<View style={styles.contentContainer}>
<Text>Awesome 🎉</Text>
</View>
</BottomSheet>
</View>
);
};
/*
* Must wrap component with gestureHandlerRootHOC on Android or the
* <BottomSheet /> component will not respond to gestures to dismiss the
* <BottomSheet />.
*/
const AppContainer = gestureHandlerRootHOC(() => (<App />));
const styles = StyleSheet.create({
container: {
flex: 1,
padding: 24,
backgroundColor: 'grey',
},
contentContainer: {
flex: 1,
alignItems: 'center',
},
});
export default AppContainer;
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I was just wondering how I can go about contributing to the react-native-bottom-sheet docs? Is there a public repo which contain the code for the docs website?
What brings me here is today I had trouble getting the quick start example to work on Android, but figured out a fix, and thought maybe I should contribute my fix to the docs so others don't run into the same issue.
For reference here is my fix for Android (involves adding gestureHandlerRootHOC wrapper to fix Android issue where BottomSheet does not respond to gestures to close the sheet):
Beta Was this translation helpful? Give feedback.
All reactions