Clojurians
#cljsrn
<
2016-05-25
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

vikeri07:05:56

@madvas: really neat with a full project up on github! A coupe of questions, why did you put the navigation state in a separate atom and not in the re-frame logic?

madvas07:05:22

@vikeri: good question. Since react-native-navigation is really native navigation, that also means u don’t have any access to it’s state. So I tried to mimic its state in cljs. I bundled it into separate state atom, so whole logic of navigation can be in one file, cuz I might create library from it in future, so it can work more out of the box for others :slightly_smiling_face:

vikeri08:05:18

@madvas: Alright, I see that you don’t want to couple it to re-frame if you want to make it a library, the downside is that all the re-frame goodness like debug etc wont be present.

madvas08:05:13

@vikeri: that’s true, but you can read navigation state at any time for debugging by simply nav/get-nav-state . but I might give it some more hammock time tho :wink:

savelichalex14:05:03

@madvas: Your solution work only on ios, isn’t it?

madvas14:05:55

@savelichalex: yes, but support for android from react-native-navigation is “Coming soon” according to their page :slightly_smiling_face: https://github.com/wix/react-native-navigation

savelichalex14:05:40

@madvas: ok, another question) If your nav state is another atom then re-frame state how you do dispatch? I can’t find it) You do 2 dispatches from view, one for navigation and one for re-frame state?

savelichalex14:05:54

@vikeri: What are you think about it?

savelichalex14:05:50

I’m watching in both solution, with experimental navigation and what @madvas do

savelichalex14:05:00

Trying to choose one)

vikeri14:05:33

@savelichalex, @madvas: Personally I think that following what facebook are focusing on internally, NavigationExperimental, is the way to go. Especially since the abstract model fits very well with re-frame. But it is still very Experimental, so I’m waiting for the API to settle down a bit before I try to make something more around it.

savelichalex14:05:04

It maybe better to set scene in re-frame state and add sub on it?

vikeri14:05:18

NavigationExperimental also fits well with Redux which seems to be quite popular in the React World. Hopefully we’ll be able to piggyback on tooling and stuff that comes up around NavigationExperimental.

madvas14:05:59

@savelichalex: Let me explain a bit. Nav state atom isn’t anyhow related to re-frame, it lives on its own. It’s main purpose is, when you do hot reload with figwheel, Navigation can reassemble itself back to original state, so you don’t have to navigate again. This is normal for regular react navigations, not for native one. when you run start-single-screen-app! you can pass persist-state? it means if it’ll reconstruct old nav state or starts from homepage.

madvas14:05:35

@savelichalex: I can tell you straight away NavigationExperimental plays much better with re-frame/Om than react-native-navigation. If you really want native navigation, with lot of sugar around react-native-navigation is usable.

savelichalex14:05:42

Looks like Android support is crucial factor for me right now) Thanks guys!

savelichalex14:05:56

Honestly both solutions looks good) @madvas great work around react-native-navigation!

madvas14:05:06

@savelichalex: thanks, if I find time to make it into library I’ll let you know :wink:

alwx15:05:09

guys, I've updated luno-react-native (https://github.com/alwx/luno-react-native), it now uses the latest versions of re-natal and react native and works perfectly again. thanks for creating issues and waiting for so long for my fixes :slightly_smiling_face: