From 6ab4baa246976309d60b169717ef2a1860260997 Mon Sep 17 00:00:00 2001 From: Andrew Tsukuda Date: Fri, 4 Nov 2022 11:26:44 -0700 Subject: [PATCH] Fix Memory leak in BottomSheetBackdrop Fix Memory leak in BottomSheetBackdrop that occurs when the backdrop tries to set the `pointerEvents` to `none` when dismissing the modal even though we don't need to. If the `disappearsOnIndex` is set to `-1` and the `animatedIndex` is `<= -1` , there is no need to call `setEventPointers` since the modal should be removed. --- src/components/bottomSheetBackdrop/BottomSheetBackdrop.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/bottomSheetBackdrop/BottomSheetBackdrop.tsx b/src/components/bottomSheetBackdrop/BottomSheetBackdrop.tsx index 35597ce60..964bc25b0 100644 --- a/src/components/bottomSheetBackdrop/BottomSheetBackdrop.tsx +++ b/src/components/bottomSheetBackdrop/BottomSheetBackdrop.tsx @@ -105,7 +105,7 @@ const BottomSheetBackdropComponent = ({ useAnimatedReaction( () => animatedIndex.value <= disappearsOnIndex, (shouldDisableTouchability, previous) => { - if (shouldDisableTouchability === previous) { + if (shouldDisableTouchability === previous || disappearsOnIndex === -1) { return; } runOnJS(handleContainerTouchability)(shouldDisableTouchability);