fix unable to open add-new-contact screen if hardware button is pressed while qr scanner is open (#18296)
This commit is contained in:
parent
f2c69ab9a8
commit
fc591f303c
|
@ -180,6 +180,11 @@
|
||||||
app-state-listener (.addEventListener rn/app-state "change" set-torch-off-fn)]
|
app-state-listener (.addEventListener rn/app-state "change" set-torch-off-fn)]
|
||||||
#(.remove app-state-listener)))
|
#(.remove app-state-listener)))
|
||||||
|
|
||||||
|
(defn- navigate-back-handler
|
||||||
|
[]
|
||||||
|
(rf/dispatch [:navigate-back])
|
||||||
|
true)
|
||||||
|
|
||||||
(defn f-view-internal
|
(defn f-view-internal
|
||||||
[{:keys [title subtitle validate-fn on-success-scan error-message]}]
|
[{:keys [title subtitle validate-fn on-success-scan error-message]}]
|
||||||
(let [insets (safe-area/get-insets)
|
(let [insets (safe-area/get-insets)
|
||||||
|
@ -197,15 +202,16 @@
|
||||||
(boolean (not-empty @qr-view-finder)))
|
(boolean (not-empty @qr-view-finder)))
|
||||||
camera-ready-to-scan? (and show-camera?
|
camera-ready-to-scan? (and show-camera?
|
||||||
(not @qr-code-succeed?))]
|
(not @qr-code-succeed?))]
|
||||||
(rn/use-effect
|
|
||||||
#(set-listener-torch-off-on-app-inactive torch?))
|
|
||||||
|
|
||||||
(rn/use-effect
|
(rn/use-effect
|
||||||
(fn []
|
(fn []
|
||||||
|
(rn/hw-back-add-listener navigate-back-handler)
|
||||||
|
(set-listener-torch-off-on-app-inactive torch?)
|
||||||
(when-not @camera-permission-granted?
|
(when-not @camera-permission-granted?
|
||||||
(permissions/permission-granted? :camera
|
(permissions/permission-granted?
|
||||||
|
:camera
|
||||||
#(reset! camera-permission-granted? %)
|
#(reset! camera-permission-granted? %)
|
||||||
#(reset! camera-permission-granted? false)))))
|
#(reset! camera-permission-granted? false)))
|
||||||
|
#(rn/hw-back-remove-listener navigate-back-handler)))
|
||||||
[:<>
|
[:<>
|
||||||
[rn/view {:style style/background}]
|
[rn/view {:style style/background}]
|
||||||
(when camera-ready-to-scan?
|
(when camera-ready-to-scan?
|
||||||
|
|
Loading…
Reference in New Issue