This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-30
Channels
- # bangalore-clj (1)
- # beginners (104)
- # boot (207)
- # cider (173)
- # cljs-dev (157)
- # cljsjs (1)
- # cljsrn (51)
- # clojure (196)
- # clojure-berlin (1)
- # clojure-chicago (1)
- # clojure-italy (4)
- # clojure-new-zealand (1)
- # clojure-nl (1)
- # clojure-russia (28)
- # clojure-spec (17)
- # clojure-uk (73)
- # clojured (13)
- # clojurescript (110)
- # core-async (4)
- # datascript (25)
- # datomic (92)
- # editors (1)
- # emacs (157)
- # events (4)
- # hoplon (16)
- # klipse (74)
- # lein-figwheel (10)
- # leiningen (2)
- # lumo (13)
- # off-topic (78)
- # om (3)
- # om-next (3)
- # onyx (14)
- # protorepl (1)
- # re-frame (17)
- # reagent (23)
- # remote-jobs (1)
- # ring-swagger (33)
- # schema (2)
- # slack-help (3)
- # spacemacs (7)
- # testing (1)
- # yada (7)
@ejelome what kind?
https://facebook.github.io/react-native/docs/using-navigators.html#pushing-scenes-onto-the-stack
I can display the text, e.g. [touchable-highlight {:on-press <no-idea-here>} [text "Tap me to load the next scene"]]
,
but I have no idea how can I actually call that function via this.props.onForward
or this.props.onBack
@ejelome the code in onForward is all about pushing a new route onto stack.
the navigation object should contain information on what current route you’re in, and that helps you decide what view to show, given the route index or key.
I would recommend you use navigationExperimental though, because that’s the future, and they’ve said this is what they’re going to support in the future.
it’s also highly compatible with om.next
hey, thanks @levitanong, will look on that navigationExperimental, although for the meantime, I would like to do a 1:1 version of the samples, this is the last one afaik, I've tried this:
core.cljs
:
[navigator {:initialRoute {:title "My Initial Scene"
:index 0}
:renderScene (fn [route, navigator_]
[my-scene {:title (.-title route)
:onForward (fn []
(.push navigator {:title "Scene" (.-index route)
:index (inc (.-index route))}))
:onBack (fn []
(if (pos? (.-index route))
(.pop navigator_)))}])}]
my_scene.cljs
:
(def my-scene [props]
[view
[text "Current Scene: " (.-title props)]
[touchable-highlight {:onPress (.-onForward props)}
[text "Tap me to load the next scene"]]
[touchable-highlight {:onPress (.-onBack props)}
[text "Tap me to go back"]]])
you probably need to pass a js data structure to .push
not a cljs data strcuture
@ejelome i concur with @pesterhazy
i don’t think there’s anything wrong with (.push navigator)
yeah you're strangely passing onForward to your own component (?)
my scene receives a javascript prop object
somehow
ah that's a translation of the example in the fb docs
but he’s passing a cljs object to my-scene
and accessing it like js
inside my-scene
well the problem is just in calling a reagent component
have you looked into reagent's documentation yet?
here are some resources: https://github.com/reagent-project/reagent/wiki/Links-and-Resources
so you don't need to pass on-forward etc at all
you need to make the navigator available to the component
one more problem
you need (r/as-element [my-scene ...])
in the render-scene fn
RN doesn't know how to do anything with clojurescript PersistenVectors
oh, I have that on my machine, forgot to type it again here XD, yes, I did that, but my main confusion was accessing the props
thanks @levitanong and @pesterhazy, very helpful, appreciate it 🙂
you're welcome
It'd be great if you could add some docs on how to use the navigator here: https://github.com/mjmeintjes/boot-react-native/wiki/Using-React-Components
maybe even add your 1-1 translation of the navigator example in the RN docs?
that'd be super helpful to newcomers
great
I'm trying to compile to run a re-natal/om-net project on an iOS device and I'm getting:
om-1.0.0-alpha41.jar!/om/externs.js:4: WARNING - name React is not defined in the externs.
Does this need to be manually added to the ios prod target?you may not need to care about externs
personally I'm not convinced adv compilation makes much sense with react native
Looks like there was a breaking change from .39 to .40 w/r/t native modules? https://medium.com/@thisismissem/how-to-upgrade-react-native-modules-in-a-backwards-compatible-manner-a5b5c48d590c#.6cy9nzepv
How on earth anyone thought renaming a header file was ever a good idea, I don't know honestly