Skip to content

Commit 55c9857

Browse files
committed
chore: updated detached modal example
1 parent af53c28 commit 55c9857

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

example/app/src/screens/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const screens = [
5353
getScreen: () => require('./modal/StackExample').default,
5454
},
5555
{
56-
name: 'Dynamic Snap Point',
56+
name: 'Dynamic Sizing',
5757
slug: 'Modal/DynamicSnapPointExample',
5858
getScreen: () => require('./modal/DynamicSnapPointExample').default,
5959
},
@@ -88,7 +88,7 @@ export const screens = [
8888
getScreen: () => require('./advanced/BackdropExample').default,
8989
},
9090
{
91-
name: 'Dynamic Snap Point',
91+
name: 'Dynamic Sizing',
9292
slug: 'Advanced/DynamicSnapPointExample',
9393
getScreen: () => require('./advanced/DynamicSnapPointExample').default,
9494
},

example/app/src/screens/modal/DetachedExample.tsx

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
BottomSheetModal,
66
BottomSheetView,
77
BottomSheetFooter,
8-
useBottomSheetDynamicSnapPoints,
98
} from '@gorhom/bottom-sheet';
109
import { Button } from '../../components/button';
1110
import { ContactItem } from '../../components/contactItem';
@@ -18,16 +17,9 @@ const DetachedExample = () => {
1817
const bottomSheetRef = useRef<BottomSheetModal>(null);
1918

2019
// variables
21-
const initialSnapPoints = useMemo(() => ['CONTENT_HEIGHT'], []);
2220
const data = useMemo(() => createContactListMockData(2), []);
2321

2422
// hooks
25-
const {
26-
animatedHandleHeight,
27-
animatedSnapPoints,
28-
animatedContentHeight,
29-
handleContentLayout,
30-
} = useBottomSheetDynamicSnapPoints(initialSnapPoints);
3123
const { bottom: safeBottomArea } = useSafeAreaInsets();
3224

3325
// callbacks
@@ -73,9 +65,7 @@ const DetachedExample = () => {
7365
<Button label="Close" onPress={handleClosePress} />
7466
<BottomSheetModal
7567
ref={bottomSheetRef}
76-
snapPoints={animatedSnapPoints}
77-
handleHeight={animatedHandleHeight}
78-
contentHeight={animatedContentHeight}
68+
enableDynamicSizing={true}
7969
bottomInset={safeBottomArea + 34}
8070
enablePanDownToClose={true}
8171
style={styles.sheetContainer}
@@ -87,7 +77,6 @@ const DetachedExample = () => {
8777
<BottomSheetView
8878
style={styles.contentContainerStyle}
8979
enableFooterMarginAdjustment={true}
90-
onLayout={handleContentLayout}
9180
>
9281
{data.map(renderItem)}
9382
</BottomSheetView>

0 commit comments

Comments
 (0)