Skip to main content
Version: v4 (Reanimated v2)

BottomSheetFooter

A pre-built component that sticks to the bottom of the BottomSheet and can be modify to fit your own custom interaction.

Props

animatedFooterPosition

Calculated footer animated position.

typedefaultrequired
Animated.SharedValue<number>0NO

bottomInset

Bottom inset to be added below the footer.

typedefaultrequired
number0NO

children

Component to be placed in the footer.

typedefaultrequired
ReactNode | ReactNode[]undefinedNO

Example

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

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

// variables
const snapPoints = useMemo(() => ['25%', '50%'], []);

// renders
const renderFooter = useCallback(
props => (
<BottomSheetFooter {...props} bottomInset={24}>
<View style={styles.footerContainer}>
<Text style={styles.footerText}>Footer</Text>
</View>
</BottomSheetFooter>
),
[]
);
return (
<View style={styles.container}>
<BottomSheet
ref={bottomSheetRef}
index={1}
snapPoints={snapPoints}
footerComponent={renderFooter}
>
<View style={styles.contentContainer}>
<Text>Awesome 🎉</Text>
</View>
</BottomSheet>
</View>
);
};

const styles = StyleSheet.create({
container: {
flex: 1,
padding: 24,
backgroundColor: 'grey',
},
contentContainer: {
flex: 1,
alignItems: 'center',
},
footerContainer: {
padding: 12,
margin: 12,
borderRadius: 12,
backgroundColor: '#80f',
},
footerText: {
textAlign: 'center',
color: 'white',
fontWeight: '800',
},
});

export default App;