helix

https://github.com/Lokeh/helix
2020-11-17T15:36:30.170Z

I shared this in the re-frame channel but I thought I'd share it here too, half in case it's useful to anyone else, and half in case someone can point out some flaws: https://gist.github.com/tomconnors/bd3fb275f893a3f16295c2ca93a32b2d - it's an implementation of use-sub for using re-frame subs as react hooks.

jaime 2020-11-17T20:01:33.173800Z

Hi, why is ^:native is causing Error: [object Object] is not ISeqable when I'm accessing the (.-button theme) but not when using keyword (:button theme) ... Then why removing ^:native metadata and accessing (.-button theme) works?

value of theme #js {:button #js {:color #6b46c1}, :input #js {:color #4a5568, :borderColor #cbd5e0, :borderWidth 1, :height 40}}

(defnc button [{:keys [on-press data-testid title color]}]
  (let [theme (useTheme)]
    (println "theme " theme)
    ($ rn/Button {:style (.-button theme) <------------ seems like (.-button theme) causes error when adding ^:native
                  :color (.. theme -button -color)
                  :title title
                  :on-press on-press
                  :data-testid data-testid})))

jaime 2020-11-17T20:11:40.174200Z

After experimenting a bit, I think the issue is ^:native requires cljs map and not js object... (.-button theme) returns js object, hence the error? The reason (:button theme) works with ^:native metadata is because it returns nil?

lilactown 2020-11-17T22:48:12.174500Z

Hmmm