Skip to main content
Version: v5

Usage

Here is a simple usage of the Bottom Sheet, with non-scrollable content. For more scrollable usage please read Scrollables.

import React, { useCallback, useMemo, useRef } from 'react';
import { View, Text, StyleSheet } from 'react-native';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import BottomSheet, { BottomSheetView } from '@gorhom/bottom-sheet';

const App = () => {
// ref
const bottomSheetRef = useRef<BottomSheet>(null);

// callbacks
const handleSheetChanges = useCallback((index: number) => {
console.log('handleSheetChanges', index);
}, []);

// renders
return (
<GestureHandlerRootView style={styles.container}>
<BottomSheet
ref={bottomSheetRef}
onChange={handleSheetChanges}
>
<BottomSheetView style={styles.contentContainer}>
<Text>Awesome ๐ŸŽ‰</Text>
</BottomSheetView>
</BottomSheet>
</GestureHandlerRootView>
);
};

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: 'grey',
},
contentContainer: {
flex: 1,
padding: 36,
alignItems: 'center',
},
});

export default App;