From 0cb9897bdfc1824bd2b17a7c11cc7e1d0ae05888 Mon Sep 17 00:00:00 2001 From: GleidsonDaniel Date: Tue, 7 Mar 2023 16:36:12 -0300 Subject: [PATCH] move to useWindowDimensions --- app/lib/hooks/useSnaps.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/lib/hooks/useSnaps.ts b/app/lib/hooks/useSnaps.ts index 2386d11eb..2c1cc2cde 100644 --- a/app/lib/hooks/useSnaps.ts +++ b/app/lib/hooks/useSnaps.ts @@ -1,4 +1,4 @@ -import { useDimensions } from '@react-native-community/hooks'; +import { useWindowDimensions } from 'react-native'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; // Not sure if it's worth adding this here in the context of the actionSheet @@ -8,7 +8,7 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context'; */ export const useSnaps = (snaps: number[]): string[] => { const insets = useSafeAreaInsets(); - const { screen } = useDimensions(); + const { height, scale } = useWindowDimensions(); const percentage = insets.bottom + insets.top > 75 ? 110 : 100; - return snaps.map(snap => `${((percentage * snap) / (screen.height * screen.scale)).toFixed(2)}%`); + return snaps.map(snap => `${((percentage * snap) / (height * scale)).toFixed(2)}%`); };