1
1
import { ReactNode , useEffect , useRef } from 'react' ;
2
2
3
- import { BottomSheetModal } from '@gorhom/bottom-sheet' ;
3
+ import { BottomSheetModal , BottomSheetScrollView } from '@gorhom/bottom-sheet' ;
4
+ import { BottomSheetScrollViewProps } from '@gorhom/bottom-sheet/lib/typescript/components/bottomSheetScrollable/types' ;
4
5
import { SafeAreaView , ViewStyle } from 'react-native' ;
5
6
6
7
import { useColorMode } from '../../hooks' ;
@@ -17,6 +18,7 @@ import { mergeRefs } from '../utils/merge-refs';
17
18
interface DraggableModalOptions {
18
19
isOpen ?: boolean ;
19
20
onClose ?: ( ) => void ;
21
+ scrollViewProps ?: BottomSheetScrollViewProps ;
20
22
}
21
23
22
24
export interface DraggableModalProps
@@ -33,7 +35,7 @@ export const DraggableModal = forwardRef<
33
35
const { colorMode } = useColorMode ( ) ;
34
36
35
37
const bottomSheetModalRef = mergeRefs ( _ref , ref ) ;
36
- const { children, isOpen, onClose, h, ...rest } = props ;
38
+ const { children, isOpen, onClose, h, scrollViewProps , ...rest } = props ;
37
39
38
40
useEffect ( ( ) => {
39
41
if ( isOpen ) {
@@ -93,13 +95,15 @@ export const DraggableModal = forwardRef<
93
95
backgroundStyle = { bottomSheetBackgroundStyleObject as ViewStyle }
94
96
handleIndicatorStyle = { handleStyleObject }
95
97
>
96
- < ficus . BottomSheetView { ...rest } >
97
- < Box h = { h ?? '100%' } >
98
- < SafeAreaView style = { safeAreaViewStyle } >
99
- { children as ReactNode }
100
- </ SafeAreaView >
101
- </ Box >
102
- </ ficus . BottomSheetView >
98
+ < BottomSheetScrollView { ...scrollViewProps } >
99
+ < ficus . BottomSheetView { ...rest } >
100
+ < Box h = { h ?? '100%' } >
101
+ < SafeAreaView style = { safeAreaViewStyle } >
102
+ { children as ReactNode }
103
+ </ SafeAreaView >
104
+ </ Box >
105
+ </ ficus . BottomSheetView >
106
+ </ BottomSheetScrollView >
103
107
</ ficus . BottomSheetModal >
104
108
) ;
105
109
} ) ;
0 commit comments