I want to give margins from the bottom and both sides.
so i gave margins backgroundcomponent it doesn’t work i expected
I using BottomSheetFlatList in BottomSheetModal (@gorhom/bottom-sheet )
<BottomSheetModal
ref={yearBottomSheetModalRef}
index={0}
snapPoints={snapPoints}
backdropComponent={renderBackdrop}
handleIndicatorStyle={{backgroundColor: '#E8EAED'}}
bottomInset={170}
backgroundComponent={renderBackground}
style={{
marginHorizontal: 16,
marginBottom: 17,
overflow: 'hidden',
}}>
<BottomSheetFlatList data={YEAR_DATA} renderItem={yearRenderItem} />
</BottomSheetModal>
const renderBackground = useCallback(
(props: any) => <BottomSheetBackground {...props} />,
[],
);
import {View, Text} from 'react-native';
import React from 'react';
const BottomSheetBackground = ({style}: any) => {
return (
<View
style={[{backgroundColor: 'red', borderRadius: 20}, {...style}]}></View>
);
};
export default BottomSheetBackground;
but it’s not working
can i set bottomradius for bottomsheetbackground?
2
Answers
I think to archive this kind of view, you can use react-native-modal instead of bottom sheet and customise it as per your requirement
You can add detached prop to
BottomSheetModal
, this will make BottomSheetModal to detach from the bottom of the screen.adjust your BottomSheetBackground & BottomSheetModal child style with
marginBottom
andborderRadius