Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reagent defstyled issues #60

Open
knubie opened this issue Oct 19, 2019 · 0 comments
Open

Reagent defstyled issues #60

knubie opened this issue Oct 19, 2019 · 0 comments

Comments

@knubie
Copy link

knubie commented Oct 19, 2019

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant