Ah, so to get the style prop converted to js and the camel casing, I’d need to somehow tag the react native components as native
#?(:clj
(defn gen-tag
[t]
`(defmacro ~t [& args#]
`(hx/$ ^:native (symbol “rn” (str t)) ~@args#))))
that doesn’t work, I guess because ^:native is a reader tag and evaluated at read time rather than macroexpansion time
I also tried (with-meta … {:native true}) but I think I’ve lost myself too deep in the macro
I guess because rn/Text is a js object that doesn’t implement IMeta
maybe I can call specify
but the examples look easier some how
Try tagging the symbol at macro time
Surprised ^:native doesn't work
I think ^:native just disappears from the call to gen-tag
(macroexpand `($ ^:native ~(symbol "foo") {:foo-bar "baz"}))
doesn’t seem to work either(macroexpand `($ ~(with-meta (symbol "foo") {:native true}) {:foo-bar "baz"}))
seems to work(helix.core/create-element "foo" (helix.impl.props/native-props {:foo-bar "baz"}))
hmm yes I did try a with-meta variant
I’ll have another go
I’m in over my head a bit with the macro calling a function that generates the code to generate a macro 😄
I think I may have messed up some splicing
oh wait, I think it’s working, but I’m perhaps getting another unrelated error
does that work with a namespaced symbol?
I think I’m losing the namespace somewhere
(defn gen-tag
[t]
`(defmacro ~t [& args#]
`(hx/$ ~(with-meta (symbol "rn" ~(str t)) {:native true})
~@args#)))
(macroexpand '(Text {:style {:backgroundColor "red"}}))
=>
(helix.core/create-element Text (helix.impl.props/native-props {:style {:backgroundColor red}}))
ah perhaps it’s this line https://github.com/Lokeh/helix/blob/master/src/helix/core.clj#L28-L30
stripping the ns
aha
good catch
Pushed a fix
do you need me to publish to clojars?
That would be great but no rush, I'm checking off for the week :)
pushed out 0.0.6. have a great weekend
Awesome! Thanks 🙌🙌