From 9f04d557d202ab8570b1b409332bfdd129e5efa4 Mon Sep 17 00:00:00 2001 From: Mo Gorhom Date: Tue, 12 Oct 2021 08:56:27 +0100 Subject: [PATCH] fix: hide the bottom sheet on closed (#690) --- src/components/bottomSheet/BottomSheet.tsx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/components/bottomSheet/BottomSheet.tsx b/src/components/bottomSheet/BottomSheet.tsx index 6ff8ed033..36060012d 100644 --- a/src/components/bottomSheet/BottomSheet.tsx +++ b/src/components/bottomSheet/BottomSheet.tsx @@ -1147,13 +1147,17 @@ const BottomSheetComponent = forwardRef( //#endregion //#region styles - const containerAnimatedStyle = useAnimatedStyle(() => ({ - transform: [ - { - translateY: animatedPosition.value, - }, - ], - })); + const containerAnimatedStyle = useAnimatedStyle( + () => ({ + opacity: animatedIndex.value === -1 ? 0 : 1, + transform: [ + { + translateY: animatedPosition.value, + }, + ], + }), + [animatedPosition, animatedIndex] + ); const containerStyle = useMemo( () => [_providedStyle, styles.container, containerAnimatedStyle], [_providedStyle, containerAnimatedStyle]