From ae41b2da650d2be614d840fbdfe1d29db6d7a575 Mon Sep 17 00:00:00 2001 From: gorhom Date: Sun, 20 Oct 2024 19:00:45 +0200 Subject: [PATCH] fix(#1983): updated shared values access as hook dependancies --- src/components/bottomSheet/BottomSheet.tsx | 12 ++++++------ .../bottomSheetBackdrop/BottomSheetBackdrop.tsx | 2 +- .../createBottomSheetScrollableComponent.tsx | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/bottomSheet/BottomSheet.tsx b/src/components/bottomSheet/BottomSheet.tsx index 9697a22b..ff24acda 100644 --- a/src/components/bottomSheet/BottomSheet.tsx +++ b/src/components/bottomSheet/BottomSheet.tsx @@ -200,7 +200,7 @@ const BottomSheetComponent = forwardRef( return $modal ? _animatedContainerHeight.value - verticalInset : _animatedContainerHeight.value; - }, [topInset, bottomInset, $modal, _animatedContainerHeight.value]); + }, [topInset, bottomInset, $modal, _animatedContainerHeight]); const animatedContainerOffset = useReactiveSharedValue( _providedContainerOffset ?? INITIAL_CONTAINER_OFFSET ) as Animated.SharedValue; @@ -221,7 +221,7 @@ const BottomSheetComponent = forwardRef( ); const animatedHighestSnapPoint = useDerivedValue( () => animatedSnapPoints.value[animatedSnapPoints.value.length - 1], - [animatedSnapPoints.value] + [animatedSnapPoints] ); const animatedClosedPosition = useDerivedValue(() => { let closedPosition = animatedContainerHeight.value; @@ -231,10 +231,10 @@ const BottomSheetComponent = forwardRef( } return closedPosition; - }, [animatedContainerHeight.value, $modal, detached, bottomInset]); + }, [animatedContainerHeight, $modal, detached, bottomInset]); const animatedSheetHeight = useDerivedValue( () => animatedContainerHeight.value - animatedHighestSnapPoint.value, - [animatedContainerHeight.value, animatedHighestSnapPoint.value] + [animatedContainerHeight, animatedHighestSnapPoint] ); const animatedCurrentIndex = useReactiveSharedValue( animateOnMount ? -1 : _providedIndex @@ -1522,7 +1522,7 @@ const BottomSheetComponent = forwardRef( return { paddingBottom: animatedContainerHeight.value, }; - }, [animatedContainerHeight.value, detached]); + }, [animatedContainerHeight, detached]); const contentMaskContainerStyle = useMemo( () => [styles.contentMaskContainer, contentMaskContainerAnimatedStyle], [contentMaskContainerAnimatedStyle] @@ -1581,7 +1581,7 @@ const BottomSheetComponent = forwardRef( evaluatePosition(ANIMATION_SOURCE.SNAP_POINT_CHANGE); }, - [isLayoutCalculated.value, animatedSnapPoints.value] + [isLayoutCalculated, animatedSnapPoints] ); /** diff --git a/src/components/bottomSheetBackdrop/BottomSheetBackdrop.tsx b/src/components/bottomSheetBackdrop/BottomSheetBackdrop.tsx index b30464d4..3b9bf879 100644 --- a/src/components/bottomSheetBackdrop/BottomSheetBackdrop.tsx +++ b/src/components/bottomSheetBackdrop/BottomSheetBackdrop.tsx @@ -106,7 +106,7 @@ const BottomSheetBackdropComponent = ({ ), flex: 1, }), - [animatedIndex.value, appearsOnIndex, disappearsOnIndex, opacity] + [animatedIndex, appearsOnIndex, disappearsOnIndex, opacity] ); const containerStyle = useMemo( () => [styles.container, style, containerAnimatedStyle], diff --git a/src/components/bottomSheetScrollable/createBottomSheetScrollableComponent.tsx b/src/components/bottomSheetScrollable/createBottomSheetScrollableComponent.tsx index 7ca81ac9..09f09da4 100644 --- a/src/components/bottomSheetScrollable/createBottomSheetScrollableComponent.tsx +++ b/src/components/bottomSheetScrollable/createBottomSheetScrollableComponent.tsx @@ -116,7 +116,7 @@ export function createBottomSheetScrollableComponent( ? animatedFooterHeight.value : 0, }), - [animatedFooterHeight.value, enableFooterMarginAdjustment] + [animatedFooterHeight, enableFooterMarginAdjustment] ); const containerStyle = useMemo(() => { return enableFooterMarginAdjustment