Skip to content

Commit

Permalink
Wrap navigation functions in js/requestAnimationFrame
Browse files Browse the repository at this point in the history
Did it to get re-frame work done before next render
  • Loading branch information
ulisesmac committed Jan 25, 2024
1 parent 01e1ce1 commit eee36e6
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions src/status_im/navigation/effects.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,19 @@
(defn- navigate
[component]
(let [{:keys [options]} (get views/screens component)]
(dismiss-all-modals)
(navigation/push
(name @state/root-id)
{:component {:id component
:name component
:options (merge (options/default-root)
(options/statusbar-and-navbar)
options
(if (:topBar options)
(options/merge-top-bar (options/topbar-options) options)
{:topBar {:visible false}}))}})))
(js/requestAnimationFrame
(fn []
(dismiss-all-modals)
(navigation/push
(name @state/root-id)
{:component {:id component
:name component
:options (merge (options/default-root)
(options/statusbar-and-navbar)
options
(if (:topBar options)
(options/merge-top-bar (options/topbar-options) options)
{:topBar {:visible false}}))}})))))

(rf/reg-fx :navigate-to navigate)

Expand All @@ -65,15 +67,17 @@
(defn- navigate-to-within-stack
[[component comp-id]]
(let [{:keys [options]} (get views/screens component)]
(navigation/push
(name comp-id)
{:component {:id component
:name component
:options (merge (options/statusbar-and-navbar)
options
(if (:topBar options)
(options/merge-top-bar (options/topbar-options) options)
{:topBar {:visible false}}))}})))
(js/requestAnimationFrame
(fn []
(navigation/push
(name comp-id)
{:component {:id component
:name component
:options (merge (options/statusbar-and-navbar)
options
(if (:topBar options)
(options/merge-top-bar (options/topbar-options) options)
{:topBar {:visible false}}))}})))))

(rf/reg-fx :navigate-to-within-stack navigate-to-within-stack)

Expand Down

0 comments on commit eee36e6

Please sign in to comment.