From f394fcc3d5f1ae4b5924be81e30fa589cdb76de9 Mon Sep 17 00:00:00 2001 From: Parvesh Monu Date: Mon, 19 Feb 2024 22:42:34 +0530 Subject: [PATCH] fix android hardware back button is not working for nested sheet-screens (#18886) --- src/status_im/common/bottom_sheet_screen/view.cljs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/status_im/common/bottom_sheet_screen/view.cljs b/src/status_im/common/bottom_sheet_screen/view.cljs index 498dad3383..e9783b456e 100644 --- a/src/status_im/common/bottom_sheet_screen/view.cljs +++ b/src/status_im/common/bottom_sheet_screen/view.cljs @@ -4,7 +4,6 @@ [quo.theme :as theme] [react-native.core :as rn] [react-native.gesture :as gesture] - [react-native.hooks :as hooks] [react-native.platform :as platform] [react-native.reanimated :as reanimated] [react-native.safe-area :as safe-area] @@ -58,7 +57,8 @@ (set-animating-true) (reanimated/animate translate-y height 300) (reanimated/animate opacity 0 300) - (rf/dispatch [:navigate-back])) + (rf/dispatch [:navigate-back]) + true) reset-open-sheet (fn [] (reanimated/animate translate-y 0 300) (reanimated/animate opacity 1 300) @@ -66,10 +66,11 @@ (reset! scroll-enabled? true))] (rn/use-effect (fn [] + (rn/hw-back-add-listener close) (reanimated/animate translate-y 0 300) (reanimated/animate opacity 1 300) - (set-animating-false 300))) - (hooks/use-back-handler close) + (set-animating-false 300) + #(rn/hw-back-remove-listener close))) [rn/view {:style (style/container insets)} (when-not skip-background? [reanimated/view {:style (style/background opacity)}])