This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-12-01
Channels
- # admin-announcements (20)
- # aws (24)
- # beginners (323)
- # boot (60)
- # business (1)
- # cider (23)
- # clara (7)
- # cljs-dev (38)
- # cljsrn (12)
- # clojure (302)
- # clojure-canada (5)
- # clojure-dev (26)
- # clojure-miami (1)
- # clojure-nl (13)
- # clojure-russia (64)
- # clojurecup (1)
- # clojurescript (202)
- # clojurex (4)
- # code-reviews (5)
- # core-async (23)
- # cursive (39)
- # datavis (26)
- # datomic (34)
- # devcards (5)
- # editors (19)
- # emacs (4)
- # events (6)
- # funcool (55)
- # hoplon (5)
- # ldnclj (3)
- # lein-figwheel (1)
- # luminus (15)
- # om (159)
- # omnext (7)
- # onyx (107)
- # slack-help (2)
- # testing (3)
Now, I’m using https://github.com/brentvatne/react-native-linear-gradient, and almost got it to work following exactly the same steps as we did above for the TableView. I have an issue with translating the colors from cljs to js :
(lineargradient {:colors ["#4C669F" "#3B5998" "#192F6A"]}
(text nil "Login" ))
will fail with JSON value ‘#4C669F’ of type NSString cannot be converted to NSNumber
.
Here what I see in the repl when trying to convert the data structure :
(clj->js ["#4C669F" "#3B5998" "#192F6A"])
=> #js ["#4C669F" "#3B5998" "#192F6A »]
. What am I doing wrong ?Note that
(lineargradient {:colors [0x4C669F 0x3B5998 0x192F6A]}
(text nil "Login"))
doesn’t show up the colors but at least doens’t throw exceptions...(clj->js
should it be before colors?
I mean probably you should convert the whole style
(lineargradient (clj->js {:colors ["#4C669F" "#3B5998" "#192F6A”]}) (text nil "Login" ))
I forgot to say I declared the following earlier in the namespace:
(def LinearGradient (js/require "LinearGradient"))
(defn lineargradient [opts & children]
(apply js/React.createElement
LinearGradient (clj->js opts) children))
So in theory
(lineargradient {:colors ["#4C669F" "#3B5998" "#192F6A"]}
(text nil "Login" ))
is supposed to work as is.well, then the only way is to check the compiled code, set a break on createElement and see what is inside. Components expect just a string, so CLJS shouldn’t break it
Well, I’m investigating how to do that. I’ve stepped into the Chrome debugger, but where is the generated code (something like main.js when doing regular Om) ? I see index.ios.js
and the content of index.ios.bundle?platform=ios&dev=true
but neither contains my core namespace code (generated to js).
sry, I’m not using natal or ambly, cannot tell
I think this is the root cause : https://github.com/facebook/react-native/issues/3300
good to know. One thing that I learned with RN - always be on a edge, 0.12 is quite old