diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 5ad80fb93..ae240e97c 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -481,4 +481,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: aff15ad1e9bd5c910cdc2b575487ce8c56864ae7 -COCOAPODS: 1.9.1 +COCOAPODS: 1.9.3 diff --git a/example/src/screens/static/BasicExample.tsx b/example/src/screens/static/BasicExample.tsx index 3b381477d..efb2c0269 100644 --- a/example/src/screens/static/BasicExample.tsx +++ b/example/src/screens/static/BasicExample.tsx @@ -1,40 +1,32 @@ import React, { useCallback, useMemo, useRef, useState } from 'react'; import { View, StyleSheet } from 'react-native'; -import { useHeaderHeight } from '@react-navigation/stack'; -import Animated, { - interpolate, - concat, - Extrapolate, -} from 'react-native-reanimated'; +import { concat } from 'react-native-reanimated'; import { ReText, useValue } from 'react-native-redash'; -import BottomSheet, { BottomSheetFlatList } from '@gorhom/bottom-sheet'; -import Handle from '../../components/handle'; +import BottomSheet from '@gorhom/bottom-sheet'; import Button from '../../components/button'; +import ContactList from '../../components/contactList'; +import { useSafeArea } from 'react-native-safe-area-context'; const BasicExample = () => { // state const [enabled, setEnabled] = useState(true); + const [dynamicSnapPoint, setDynamicSnapPoint] = useState(450); // hooks const bottomSheetRef = useRef(null); - const headerHeight = useHeaderHeight(); + const { top: topSafeArea } = useSafeArea(); // variables - const snapPoints = useMemo(() => [150, 300, 450], []); + const snapPoints = useMemo(() => [150, dynamicSnapPoint], [dynamicSnapPoint]); const position = useValue(0); // styles - const shadowOverlayStyle = useMemo( + const containerStyle = useMemo( () => ({ - ...styles.shadowOverlay, - opacity: interpolate(position, { - inputRange: [300, 450], - outputRange: [0, 1], - extrapolate: Extrapolate.CLAMP, - }), + ...styles.container, + paddingTop: topSafeArea, }), - // eslint-disable-next-line react-hooks/exhaustive-deps - [] + [topSafeArea] ); // callbacks @@ -44,31 +36,20 @@ const BasicExample = () => { const handleSnapPress = useCallback(index => { bottomSheetRef.current?.snapTo(index); }, []); - const handleClosePress = useCallback(() => { bottomSheetRef.current?.close(); }, []); + const handleIncreaseDynamicSnapPoint = useCallback(() => { + setDynamicSnapPoint(state => state + 50); + }, []); // renders - // const renderHeader = useCallback(() => { - // return ( - // - // Basic Screen - // - // ); - // }, []); - return ( - -