[#9359] Hardware back button doesn't work on Android

Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
Andrey Shovkoplyas 2019-11-26 11:59:36 +01:00
parent 4c79d7830e
commit 02aafeac8b
No known key found for this signature in database
GPG Key ID: EAAB7C8622D860A4
1 changed files with 2 additions and 5 deletions

View File

@ -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]