[#9359] Hardware back button doesn't work on Android
Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
parent
4c79d7830e
commit
02aafeac8b
|
@ -37,22 +37,19 @@
|
||||||
(re-frame/dispatch [:screens/on-will-focus current-view-id]))
|
(re-frame/dispatch [:screens/on-will-focus current-view-id]))
|
||||||
:on-did-focus
|
:on-did-focus
|
||||||
(fn []
|
(fn []
|
||||||
|
(when @back-button-listener (.remove @back-button-listener))
|
||||||
(reset!
|
(reset!
|
||||||
back-button-listener
|
back-button-listener
|
||||||
(.addEventListener
|
(.addEventListener
|
||||||
js-dependencies/back-handler
|
js-dependencies/back-handler
|
||||||
"hardwareBackPress"
|
"hardwareBackPress"
|
||||||
(fn []
|
#(not (get back-actions/back-actions current-view-id))))
|
||||||
(not (get back-actions/back-actions current-view-id)))))
|
|
||||||
(when-not modal?
|
(when-not modal?
|
||||||
(status-bar/set-status-bar current-view-id)))
|
(status-bar/set-status-bar current-view-id)))
|
||||||
:on-will-blur
|
:on-will-blur
|
||||||
(fn [payload]
|
(fn [payload]
|
||||||
(reset! screen-focused? false)
|
(reset! screen-focused? false)
|
||||||
(log/debug :on-will-blur current-view-id)
|
(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
|
;; Reset currently mounted text inputs to their default values
|
||||||
;; on navigating away; this is a privacy measure
|
;; on navigating away; this is a privacy measure
|
||||||
(doseq [[text-input default-value] @react/text-input-refs]
|
(doseq [[text-input default-value] @react/text-input-refs]
|
||||||
|
|
Loading…
Reference in New Issue