From 02aafeac8b4624b36cf5e7babdfe92bafc7d3c1d Mon Sep 17 00:00:00 2001 From: Andrey Shovkoplyas Date: Tue, 26 Nov 2019 11:59:36 +0100 Subject: [PATCH] [#9359] Hardware back button doesn't work on Android Signed-off-by: Andrey Shovkoplyas --- src/status_im/ui/screens/routing/core.cljs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/status_im/ui/screens/routing/core.cljs b/src/status_im/ui/screens/routing/core.cljs index 192c437ecd..6774db424c 100644 --- a/src/status_im/ui/screens/routing/core.cljs +++ b/src/status_im/ui/screens/routing/core.cljs @@ -37,22 +37,19 @@ (re-frame/dispatch [:screens/on-will-focus current-view-id])) :on-did-focus (fn [] + (when @back-button-listener (.remove @back-button-listener)) (reset! back-button-listener (.addEventListener js-dependencies/back-handler "hardwareBackPress" - (fn [] - (not (get back-actions/back-actions current-view-id))))) + #(not (get back-actions/back-actions current-view-id)))) (when-not modal? (status-bar/set-status-bar current-view-id))) :on-will-blur (fn [payload] (reset! screen-focused? false) (log/debug :on-will-blur current-view-id) - (when @back-button-listener - (.remove @back-button-listener) - (reset! back-button-listener nil)) ;; Reset currently mounted text inputs to their default values ;; on navigating away; this is a privacy measure (doseq [[text-input default-value] @react/text-input-refs]