Skip to content

Commit

Permalink
chore: updated detached modal example
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhom committed Sep 17, 2023
1 parent af53c28 commit 55c9857
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
4 changes: 2 additions & 2 deletions example/app/src/screens/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const screens = [
getScreen: () => require('./modal/StackExample').default,
},
{
name: 'Dynamic Snap Point',
name: 'Dynamic Sizing',
slug: 'Modal/DynamicSnapPointExample',
getScreen: () => require('./modal/DynamicSnapPointExample').default,
},
Expand Down Expand Up @@ -88,7 +88,7 @@ export const screens = [
getScreen: () => require('./advanced/BackdropExample').default,
},
{
name: 'Dynamic Snap Point',
name: 'Dynamic Sizing',
slug: 'Advanced/DynamicSnapPointExample',
getScreen: () => require('./advanced/DynamicSnapPointExample').default,
},
Expand Down
13 changes: 1 addition & 12 deletions example/app/src/screens/modal/DetachedExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
BottomSheetModal,
BottomSheetView,
BottomSheetFooter,
useBottomSheetDynamicSnapPoints,
} from '@gorhom/bottom-sheet';
import { Button } from '../../components/button';
import { ContactItem } from '../../components/contactItem';
Expand All @@ -18,16 +17,9 @@ const DetachedExample = () => {
const bottomSheetRef = useRef<BottomSheetModal>(null);

// variables
const initialSnapPoints = useMemo(() => ['CONTENT_HEIGHT'], []);
const data = useMemo(() => createContactListMockData(2), []);

// hooks
const {
animatedHandleHeight,
animatedSnapPoints,
animatedContentHeight,
handleContentLayout,
} = useBottomSheetDynamicSnapPoints(initialSnapPoints);
const { bottom: safeBottomArea } = useSafeAreaInsets();

// callbacks
Expand Down Expand Up @@ -73,9 +65,7 @@ const DetachedExample = () => {
<Button label="Close" onPress={handleClosePress} />
<BottomSheetModal
ref={bottomSheetRef}
snapPoints={animatedSnapPoints}
handleHeight={animatedHandleHeight}
contentHeight={animatedContentHeight}
enableDynamicSizing={true}
bottomInset={safeBottomArea + 34}
enablePanDownToClose={true}
style={styles.sheetContainer}
Expand All @@ -87,7 +77,6 @@ const DetachedExample = () => {
<BottomSheetView
style={styles.contentContainerStyle}
enableFooterMarginAdjustment={true}
onLayout={handleContentLayout}
>
{data.map(renderItem)}
</BottomSheetView>
Expand Down

0 comments on commit 55c9857

Please sign in to comment.