Improve dissmiss all overlays (#15773)
This commit is contained in:
parent
6c0c742676
commit
9a8354f783
|
@ -41,10 +41,6 @@
|
||||||
[comp]
|
[comp]
|
||||||
(.catch (.dismissOverlay Navigation comp) #()))
|
(.catch (.dismissOverlay Navigation comp) #()))
|
||||||
|
|
||||||
(defn dissmiss-all-overlays
|
|
||||||
[]
|
|
||||||
(.catch (.dismissAllOverlays Navigation) #()))
|
|
||||||
|
|
||||||
(defn reg-app-launched-listener
|
(defn reg-app-launched-listener
|
||||||
[handler]
|
[handler]
|
||||||
(.registerAppLaunchedListener ^js (.events ^js Navigation) handler))
|
(.registerAppLaunchedListener ^js (.events ^js Navigation) handler))
|
||||||
|
|
|
@ -45,3 +45,11 @@
|
||||||
(update-in [:db :toasts] assoc :hide-toasts-timer-set true)
|
(update-in [:db :toasts] assoc :hide-toasts-timer-set true)
|
||||||
(assoc :dispatch-later [{:ms 500 :dispatch [:toasts/hide-with-check]}]))
|
(assoc :dispatch-later [{:ms 500 :dispatch [:toasts/hide-with-check]}]))
|
||||||
effect))))
|
effect))))
|
||||||
|
|
||||||
|
(rf/defn close-all-toasts
|
||||||
|
{:events [:toasts/close-all-toasts]}
|
||||||
|
[{:keys [db]}]
|
||||||
|
{:dispatch-n (reduce (fn [acc toast]
|
||||||
|
(conj acc [:toasts/close (key toast)]))
|
||||||
|
[]
|
||||||
|
(get-in db [:toasts :toasts]))})
|
||||||
|
|
|
@ -160,8 +160,6 @@
|
||||||
;; OVERLAY
|
;; OVERLAY
|
||||||
(def dissmiss-overlay navigation/dissmiss-overlay)
|
(def dissmiss-overlay navigation/dissmiss-overlay)
|
||||||
|
|
||||||
(def dissmiss-all-overlays navigation/dissmiss-all-overlays)
|
|
||||||
|
|
||||||
(defn show-overlay
|
(defn show-overlay
|
||||||
([comp] (show-overlay comp {}))
|
([comp] (show-overlay comp {}))
|
||||||
([comp opts]
|
([comp opts]
|
||||||
|
@ -175,8 +173,6 @@
|
||||||
:overlay {:interceptTouchOutside true}}
|
:overlay {:interceptTouchOutside true}}
|
||||||
opts)}})))
|
opts)}})))
|
||||||
|
|
||||||
(re-frame/reg-fx :dissmiss-all-overlays-fx dissmiss-all-overlays)
|
|
||||||
|
|
||||||
;; toast
|
;; toast
|
||||||
(navigation/register-component "toasts" (fn [] views/toasts) js/undefined)
|
(navigation/register-component "toasts" (fn [] views/toasts) js/undefined)
|
||||||
|
|
||||||
|
|
|
@ -143,8 +143,14 @@
|
||||||
(rf/defn dismiss-all-overlays
|
(rf/defn dismiss-all-overlays
|
||||||
{:events [:dissmiss-all-overlays]}
|
{:events [:dissmiss-all-overlays]}
|
||||||
[{:keys [db]}]
|
[{:keys [db]}]
|
||||||
{:dissmiss-all-overlays-fx nil
|
{:dispatch-n [[:hide-popover]
|
||||||
:db (-> db
|
[:hide-visibility-status-popover]
|
||||||
(dissoc :popover/popover)
|
[:hide-bottom-sheet]
|
||||||
(dissoc :visibility-status-popover/popover)
|
[:bottom-sheet-hidden]
|
||||||
(assoc-in [:bottom-sheet :hide?] true))})
|
[:hide-wallet-connect-sheet]
|
||||||
|
[:hide-wallet-connect-success-sheet]
|
||||||
|
[:hide-wallet-connect-app-management-sheet]
|
||||||
|
[:hide-signing-sheet]
|
||||||
|
[:hide-select-acc-sheet]
|
||||||
|
[:bottom-sheet/hide-old-navigation-overlay]
|
||||||
|
[:toasts/close-all-toasts]]})
|
||||||
|
|
Loading…
Reference in New Issue