Skip to content

Commit

Permalink
Replace after-render with runAfterInteractions for react-native
Browse files Browse the repository at this point in the history
  • Loading branch information
yenda committed Feb 9, 2018
1 parent 8332d11 commit f9fd906
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/re_frame/router.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
(:require [re-frame.events :refer [handle]]
[re-frame.interop :refer [after-render empty-queue next-tick]]
[re-frame.loggers :refer [console]]
[re-frame.trace :as trace :include-macros true]))
[re-frame.trace :as trace :include-macros true]
#?(:cljs [react-native :as ReactNative])))


;; -- Router Loop ------------------------------------------------------------
Expand Down Expand Up @@ -63,7 +64,8 @@
;; Events can have metadata which says to pause event processing.
;; event metadata -> "run later" functions
(def later-fns
{:flush-dom (fn [f] (after-render #(next-tick f))) ;; one tick after the end of the next annimation frame
{:flush-dom #?(:clj (fn [f] (after-render #(next-tick f)))
:cljs (fn [f] (.runAfterInteractions ReactNative/InteractionManager f))) ;; one tick after the end of the next annimation frame
:yield next-tick}) ;; almost immediately


Expand Down

0 comments on commit f9fd906

Please sign in to comment.