This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-02-18
Channels
- # admin-announcements (3)
- # announcements (7)
- # aws (1)
- # beginners (76)
- # boot (340)
- # cider (9)
- # clara (35)
- # cljs-dev (7)
- # cljsjs (16)
- # cljsrn (11)
- # clojars (1)
- # clojure (192)
- # clojure-dev (6)
- # clojure-madison (8)
- # clojure-russia (373)
- # clojurebridge (1)
- # clojured (9)
- # clojurescript (172)
- # community-development (1)
- # core-async (2)
- # cursive (7)
- # data-science (2)
- # datomic (12)
- # devcards (1)
- # dirac (63)
- # emacs (3)
- # events (10)
- # gsoc (3)
- # hoplon (1)
- # jobs (1)
- # juxt (20)
- # ldnclj (4)
- # lein-figwheel (12)
- # leiningen (1)
- # off-topic (21)
- # om (232)
- # onyx (64)
- # parinfer (8)
- # proton (21)
- # re-frame (8)
- # reagent (1)
- # ring (3)
- # ring-swagger (3)
- # slack-help (4)
- # spacemacs (6)
- # testing (3)
@adamfrey: ha. no problem. Initially I think my questions are react native related, and then later I realize I just don’t know clojure very well.
Okay, I think this question actually is React Native related. Is there a recommended way to do routing in a reactive way? Ideally, I’d like to have om-next’s state (or query?) determine router actions. So if you set a symbol like {:current-route :home}
I could react to that change and tell the router to change to a new view.
I’ve looked into react-native-router, ex-navigator, and am now playing with react-native-router-flux (for it’s claim of route dispatch from anywhere). It seems like most solutions want to declare the router as a react native component and then the navigator is passed down via props. This is not the solution I want.
I’ve also been passing down the navigator js object down through my components using om’s computed
properties. Another possiblity...
I’m doing the actual route change in my om.next mutate fns:
(defmethod mutate 'video/start
[{:keys [state]} _ {:keys [id nav]}]
{:action
(fn []
(swap! state assoc :video/focus [:video/by-id id])
(.push nav #js {:id "video-screen"}))})
So if my goal is to be able to load app-state from arbitrary sources (resume from local storage) and have the route change to reflect the stored state, could I even do that with props/computed props?
the react-native navigator
component has an :initialRoute
option. So you could store the current route the user is in localstorage , then when they close and reopen the app, pull route out of localstorage and set it as the :initialRoute
actually you could save the whole “scene stack” in storage so that if they close the app and open it back up their route history is preserved.
Interesting. I’m going to keep searching for a purely reactive solution in hopes to help my future self for tech support. If app-state could be serialized and sent over the wire I could simply run the same version of the code and swap in their app-state and have the interface reacts to the data and resume to the same state they were in.