반응형
1. Background 컴포넌트 지정
<BottomSheetModal
ref={bottomSheetModalRef}
index={0}
enablePanDownToClose={true}
snapPoints={snapPoints}
backgroundComponent={renderBackground} // 백그라운드 컴포넌트 지정
backdropComponent={renderBackdrop}
onChange={handleSheetChanges}>
....
2. 컴포넌트 props 전달
const renderBackground = useCallback(
props => <BottomSheetBackground {...props} />,
[],
);
3. 컴포넌트 생성 및 스타일 지정
const BottomSheetBackground = ({style}: any) => {
return (
<View
style={[
{
backgroundColor: 'white',
borderRadius: 30,
},
{...style},
]}
/>
);
};
반응형
'Study > React&ReactNative' 카테고리의 다른 글
React Native가 동작하는 원리 - RN의 Thread (0) | 2023.07.18 |
---|---|
React Native Patch Package 사용하기(라이브러리 패키지 패치, 수정하기) (0) | 2022.12.05 |
React Native Bottom Sheet 라이브러리 사용하기(+Backdrop 터치시 닫힘 추가) (14) | 2022.07.31 |
React Native 버전과 TypeScript 동시에 다운그레이드하여 프로젝트 만들기 (2) | 2022.07.28 |
[React Native] Mac M1 개발환경 세팅 (22.12.05수정) (0) | 2022.07.21 |