From f9e37c37af0db2ecbba0ea835c19a506ddb4bf11 Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Thu, 25 Aug 2022 09:07:57 -0400 Subject: [PATCH] Fix bottom sheet backdrop (#6595) --- app/screens/bottom_sheet/index.tsx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/app/screens/bottom_sheet/index.tsx b/app/screens/bottom_sheet/index.tsx index 41db1b31c6..a2ec9e420e 100644 --- a/app/screens/bottom_sheet/index.tsx +++ b/app/screens/bottom_sheet/index.tsx @@ -64,6 +64,15 @@ const BottomSheet = ({closeButtonId, componentId, initialSnapIndex = 0, renderCo } }, []); + const handleCloseEnd = useCallback(() => { + backdropOpacity.value = 0; + setTimeout(close, 250); + }, []); + + const handleOpenStart = useCallback(() => { + backdropOpacity.value = 1; + }, []); + useAndroidHardwareBackHandler(componentId, handleClose); useEffect(() => { @@ -147,13 +156,8 @@ const BottomSheet = ({closeButtonId, componentId, initialSnapIndex = 0, renderCo borderRadius={10} initialSnap={snapPoints.length - 1} renderContent={renderContainerContent} - onCloseEnd={close} - onCloseStart={() => { - backdropOpacity.value = 0; - }} - onOpenEnd={() => { - backdropOpacity.value = 1; - }} + onCloseEnd={handleCloseEnd} + onOpenStart={handleOpenStart} enabledBottomInitialAnimation={false} renderHeader={Indicator} enabledContentTapInteraction={false}