Fork me on GitHub
#cljsrn
<
2017-02-01
>
ejelome07:02:56

@pesterhazy finally got the navigator working, my mistake was that I didn't call them as keyword, and the the #js conversion also was required

ejelome07:02:04

however, there's an ugly delay that crumbles screen from previous scene to the next, not sure if it's genymotion thing or react's navigator problem

pesterhazy07:02:35

Try using a non debug build

pesterhazy07:02:18

In my experience it makes a huge performance difference on Android

ejelome08:02:54

it's ok if that's not what the actual users will see 😄

ejelome08:02:16

this is the working snippet btw: my_scene.cljs:

(defn my-scene [props]
  [view
   [text "Current Scene: " (:title props)]
   [touchable-highlight {:on-press (:on-forward props)}
    [text "Tap me to load the next scene"]]
   [touchable-highlight {:on-press (:on-back props)}
    [text "Tap me to go back"]]])
core.cljs:
(defn app-root []
  [navigator {:initial-route {:title "My Initial Scene"
                              :index 0}
              :render-scene (fn [route, nav]
                              (r/as-element [ms/my-scene {:title (.-title route)
                                                          :on-forward (fn []
                                                                        (.push nav #js {:title (str "Scene " (.-index route))
                                                                                        :index (inc (.-index route))}))
                                                          :on-back (fn []
                                                                     (.pop nav))}]))}])

pesterhazy08:02:32

Nice, looks good

pesterhazy08:02:59

In my code I store the navigator in an atom so I can trigger nav events from any function

pesterhazy08:02:15

It's not pretty but it works pretty well

ejelome08:02:28

thanks @pesterhazy, will try that sometime in the future, I'm also tempted to improvise but I tried to avoid it so the code can at least reflect 1:1 from the sample

pesterhazy08:02:22

Yeah I agree

pesterhazy08:02:35

For the about that's much better

pesterhazy08:02:49

For the snippet

ejelome08:02:15

and regarding putting it in the wiki, I think I'm still not capable of explaining it well, so I'm not sure, maybe you'll be better putting it there if you have the time 😄

ejelome09:02:44

and thanks again @pesterhazy, now I'm thinking if I should continue to learn re-frame or go to back-end for a while with clojure :thinking_face:

pesterhazy10:02:19

Re-frame is definitely worth learning

ejelome10:02:49

it sure is 🙂

vikeri15:02:32

On the navigation theme, I just got a VERY quick and dirty version of the new React Navigation library going. I now have tabs with a nested stack navigation. But I couldn’t read the tab routing from re-frame without getting an annoying gitter, so did it very hackily for now, the stack navigation is fully connected to re-frame though, and works well. The cljs code is very ugly, but I have a deadline so no time to clean it up. https://github.com/vikeri/re-navigate

misha23:02:46

afaiu, this thing knows how to use https://github.com/bodymovin/bodymovin jsons

misha23:02:56

yes:

Lottie is a mobile library for Android and iOS that parses Adobe After Effects animations exported as json with bodymovin and renders the vector animations natively on mobile and through React Native!