Skip to content

Reagent defstyled issues #60

Open
Open
@knubie

Description

@knubie

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions