cljss icon indicating copy to clipboard operation
cljss copied to clipboard

Reagent defstyled issues

Open knubie opened this issue 4 years ago • 0 comments

I've encountered a few issues specific to cljss.reagent/defstyled:

Style maps not transformed properly

(defstyled foo :div {})

(def some-component []
  [foo {:style {:font-size "12px"}}]

Will raise a warning from React like:

Warning: Unsupported style property font-size. Did you mean fontSize?

Which I think could be fixed by camel casing the style map here: https://github.com/clj-commons/cljss/blob/master/src/cljss/core.cljs#L106


Controlled input not working correctly

Given a defstyled input component like:

(defstyled my-input :input)

When used as a controlled input like:

(defn username-input []
  (r/with-let [val (r/atom "")]
    [my-input {:value @val
               :on-change #(reset val (-> % .-target .-value))}]))

The cursor will always move to the end of the input when the value changes, regardless of where the cursor was placed originally. (Not sure what's causing this).

knubie avatar Oct 19 '19 16:10 knubie