This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-11-16
Channels
- # admin-announcements (9)
- # beginners (112)
- # boot (223)
- # cbus (10)
- # cider (19)
- # clara (2)
- # cljs-dev (81)
- # cljsjs (3)
- # cljsrn (45)
- # clojure (239)
- # clojure-conj (12)
- # clojure-poland (2)
- # clojure-russia (56)
- # clojure-taiwan (1)
- # clojurescript (57)
- # cursive (28)
- # datomic (5)
- # events (14)
- # immutant (1)
- # jobs (1)
- # ldnclj (8)
- # off-topic (28)
- # om (80)
- # onyx (121)
- # re-frame (10)
- # sneer-br (1)
- # spacemacs (40)
- # yada (44)
[Basically I have a textinput whose bordercolor needs to be one value when there is no text in it (except the placeholder txt) and another value when there is some text in it]
@johanatan: in om you pass styles as maps:
(view {:style {:flexDirection "column" :margin 40}}
(text nil msg))
@iamjarvo: if it's passed as props, cant you do (get (om/props this) navigator)
or something like this?
(also keep in mind that (println (om/props this))
and (.log js/console (om/props this))
will print different things.
The first one gives you the clojure representation, the second one the javascript version. If you want to check what's inside the props, use println
. You don't want to navigate through all the things clojure does for you)
@dvcrn: so it looks like when I do (println (om/props this)) I get back just app-state
@dvcrn: Yea, here is a gist of my core.cljs https://gist.github.com/iamjarvo/8ca1455c44c7d2f826df
there is some useless code in there because I have been poking around to figure out hwo things work
Gonna check it when I have a bit buffer time within the next hour-ish, but it could be a bug. Let me ask in #C06DT2YSY after verifying
@dvcrn: https://github.com/omcljs/om/issues/425 also not sure this is related https://github.com/omcljs/om/issues/425
you could also get the navigator inside your navigator component and pass it directly to the child. I never tried any of that yet though
@dvcrn: I fail to see how that answers my question. I need to compute the style based on a property of the component
It is getting the property of the component that is the problem; not constructing a map
In my case, I need the style to be conditional upon the length of txt in the txt input
@johanatan: ah. How about binding the text of the input to a state piece? Something like onChange
write the current text inside a atom or similar. Then upon render, use something like (if (> (count something) 5) (merge style style-active) style)
Ahh, so I can save my state off to the side in just an atom and not go through React's 'setState' et al?
if you want to make it as correct as possible, keep the state inside the big om state atom since 1 version of the state should always represent a version of your app (including dynamic styles). But nothing prohibits you from just using a local atom that you don't expose
[and re: single big om state atom-- yea was thinking the same thing-- it really belongs in there]
@johanatan: I meant for changing state you invoke a mutator. So another piece of state would mean another mutator and another reader
Hi. Just found out about this slack channel, and thought I'd share my example app for using Reagent, React Native and re-frame to build an Android app (tictactoe) - https://github.com/mjmeintjes/cljs-react-native-tictactoe . Some cool things about it: uses boot for building, auto testing using phantomjs, fast building using :optimizations :none, "hot-reloading" while keeping app state.
@mjmeintjes: looks cool! I'll add it to the Android section to http://cljsrn.org
@mfikes Thanks. Thanks for keeping that resource up to date, used it extensively while building this example.
@mjmeintjes: Thanks for sharing!