This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-12-03
Channels
- # admin-announcements (8)
- # beginners (99)
- # boot (60)
- # cider (44)
- # cljs-dev (47)
- # cljsrn (68)
- # clojure (223)
- # clojure-art (1)
- # clojure-russia (190)
- # clojure-sg (9)
- # clojure-uk (2)
- # clojurecup (1)
- # clojurescript (59)
- # clojurex (3)
- # core-async (43)
- # core-typed (2)
- # cursive (18)
- # datavis (7)
- # datomic (16)
- # events (2)
- # funcool (3)
- # hoplon (3)
- # jobs (1)
- # lein-figwheel (10)
- # leiningen (6)
- # off-topic (1)
- # om (123)
- # onyx (57)
- # parinfer (16)
- # portland-or (2)
- # random (1)
- # re-frame (4)
- # reagent (7)
- # remote-jobs (1)
- # spacemacs (12)
Can anyone explain this business of set!ting js/React before and/or after :requiring om.next? set!ting it at all in my code gives an error at compilation time: ERROR: JSC_CONSTANT_REASSIGNED_VALUE_ERROR. constant React assigned a value more than once. Original definition at file:/Users/alan/.m2/repository/cljsjs/react/0.14.0-0/react-0.14.0-0.jar!/cljsjs/react/common/react.ext.js:11 at /Users/alan/Workspaces/Clojure/AwesomeProject/target/cljsbuild-compiler-0/hello/core.js line 5 : 0
@nodename: it was required previously (and still exists in the earlier documentation, and explained a bit there). With the latest Om it is no longer required (and is being removed from Natal)
Worked fine as a plain cljs app without Om with (def React (js/require “react-native”)
@mfikes: so with alpha 22 or maybe 24, set! js/React is not needed either before or after the require, is that right?
@nodename: Perhaps you can exclude the extra (cljsjs) React dep that Om is pulling in.
Cool. Closure may be simply pointing out something that is not compatible with it (but yet happens to work).
I think that navigator-ios doesn’t play nice with om/next as it bypasses the query mechanism. It relies on passing down the props to the components it instantiates itself.
@gphilipp: I had some troubles with that as well
I could never pass props because Om Next props are not JS objects
it didn't work out
I know @iamjarvo was also trying to get it to work
didn't investigate much further as well, as I ended up using the Navigator that React Native developed from scratch
(might be outdated, this is from almost a month ago!)
clojure
(defui WidgetComponent
static om/IQuery
(query
[this]
'[:accounts :person])
Object
(render
[this]
(let [props (om/props this)
_ (println "props in WidgetComponent:" props)]
(navigator-ios {:style {:flex 1}
:initialRoute {:component HomeComponent
:passProps (clj->js props)
}}))))
right
not sure if clj->js
won't break certain data structs
esp. when you have more deeply nested components
oh wow
quite a workaround heh
oh but that is Om Next related
Yeah, I wondered why you didn’t use om/props when reading your code, until I got bitten by this issue 😛
is the navigator-ios component a regular react component that you could render as a sub-component?
@anmonteiro: in your code, how would you get a reference to the navigator inside the WidgetComponent ?
Why do you guys need a 'navigator' anyway? I just used a :screen
entry in app-state and a change-screen
fn utilizing a mapping from screen kwd to rendering function for said screen.
[`change-screen` could either clear the previous screen data on change or preserve it]
@gphilipp: pass it as a computed
prop
look at lines 39-40
:render-scene
is a function
with args [route navigator]
so just pass it as widget-component (om/computed {} {:navigation navigator})
this is also useful (although it's in JS): https://github.com/facebook/react-native/tree/master/Examples/UIExplorer/Navigator
it's how I learned to use the navigator
@johanatan: so you can get native like navigation (smooth swipe transitions, nav bar…)