From 98fb8d24a55c064f0072c74c0bf2e1af079be819 Mon Sep 17 00:00:00 2001 From: Gheorghe Pinzaru Date: Tue, 17 Aug 2021 23:50:12 +0200 Subject: [PATCH] fix: provide dynamic initial snap points while layout is calculating (#584) * Allow usage of index when using dynamic snap points Because the number of snap points is different on the initial frame with the number when the size is known, the bottom sheet could not be used with an index value. To avoid this issue we fill the snap points array with INITIAL_SNAP_POINT. * refactor: removed unused parameter on initialSnapPoints map Co-authored-by: Mo Gorhom --- src/hooks/useBottomSheetDynamicSnapPoints.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hooks/useBottomSheetDynamicSnapPoints.ts b/src/hooks/useBottomSheetDynamicSnapPoints.ts index 15cd6c32c..a1c25735d 100644 --- a/src/hooks/useBottomSheetDynamicSnapPoints.ts +++ b/src/hooks/useBottomSheetDynamicSnapPoints.ts @@ -29,7 +29,7 @@ export const useBottomSheetDynamicSnapPoints = ( animatedHandleHeight.value === INITIAL_HANDLE_HEIGHT || animatedContentHeight.value === 0 ) { - return [INITIAL_SNAP_POINT]; + return initialSnapPoints.map(() => INITIAL_SNAP_POINT); } const contentWithHandleHeight = animatedContentHeight.value + animatedHandleHeight.value;