mirror of https://github.com/status-im/reagent.git
Ensure adapt-input-component works with uncontrolled inputs
This commit is contained in:
parent
c29276bc6b
commit
dca635e3b0
|
@ -22,11 +22,12 @@
|
||||||
(fn [props & children]
|
(fn [props & children]
|
||||||
(this-as this
|
(this-as this
|
||||||
(let [props (-> props
|
(let [props (-> props
|
||||||
|
(cond-> (:on-change props)
|
||||||
(assoc :on-change (fn [e]
|
(assoc :on-change (fn [e]
|
||||||
(.setState this #js {:value (.. e -target -value)})
|
(.setState this #js {:value (.. e -target -value)})
|
||||||
(if-let [f (:on-change props)]
|
((:on-change props) e))))
|
||||||
(f e)))
|
(cond-> (:value props)
|
||||||
:value (.-value (.-state this)))
|
(assoc :value (.-value (.-state this))))
|
||||||
rtpl/convert-prop-value)]
|
rtpl/convert-prop-value)]
|
||||||
(apply r/create-element component props (map r/as-element children)))))}) ))
|
(apply r/create-element component props (map r/as-element children)))))}) ))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue