Skip to content

Commit 9ddcae9

Browse files
committed
fix: scroll draggable modal with isScrollable prop
1 parent 5df5039 commit 9ddcae9

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

apps/docs/pages/docs/Components/draggable-modal.en-US.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ Extends every `Box` props and `BottomSheetModalProps` from `@gorhom/bottom-sheet
7272
prop={{ type: "() => void", required: false }}
7373
/>
7474

75+
### `isScrollable`
76+
77+
<PropsTable
78+
description="Boolean to indicate if the modal should be scrollable."
79+
prop={{ type: "boolean", required: false }}
80+
/>
81+
7582
### `scrollViewProps`
7683

7784
<PropsTable

packages/react-native-ficus-ui/src/components/draggable-modal/index.tsx

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { mergeRefs } from '../utils/merge-refs';
1818
interface DraggableModalOptions {
1919
isOpen?: boolean;
2020
onClose?: () => void;
21+
isScrollable?: boolean;
2122
scrollViewProps?: BottomSheetScrollViewProps;
2223
}
2324

@@ -35,7 +36,15 @@ export const DraggableModal = forwardRef<
3536
const { colorMode } = useColorMode();
3637

3738
const bottomSheetModalRef = mergeRefs(_ref, ref);
38-
const { children, isOpen, onClose, h, scrollViewProps, ...rest } = props;
39+
const {
40+
children,
41+
isOpen,
42+
onClose,
43+
h,
44+
isScrollable,
45+
scrollViewProps,
46+
...rest
47+
} = props;
3948

4049
useEffect(() => {
4150
if (isOpen) {
@@ -95,15 +104,23 @@ export const DraggableModal = forwardRef<
95104
backgroundStyle={bottomSheetBackgroundStyleObject as ViewStyle}
96105
handleIndicatorStyle={handleStyleObject}
97106
>
98-
<BottomSheetScrollView {...scrollViewProps}>
107+
{isScrollable ? (
108+
<BottomSheetScrollView {...scrollViewProps}>
109+
<Box h={h ?? '100%'}>
110+
<SafeAreaView style={safeAreaViewStyle}>
111+
{children as ReactNode}
112+
</SafeAreaView>
113+
</Box>
114+
</BottomSheetScrollView>
115+
) : (
99116
<ficus.BottomSheetView {...rest}>
100117
<Box h={h ?? '100%'}>
101118
<SafeAreaView style={safeAreaViewStyle}>
102119
{children as ReactNode}
103120
</SafeAreaView>
104121
</Box>
105122
</ficus.BottomSheetView>
106-
</BottomSheetScrollView>
123+
)}
107124
</ficus.BottomSheetModal>
108125
);
109126
});

0 commit comments

Comments
 (0)