This commit is contained in:
Juho Teperi 2018-06-18 00:57:45 +03:00
parent 8e137ec24a
commit 2c90353fce
1 changed files with 12 additions and 10 deletions

View File

@ -194,10 +194,12 @@
(declare make-element)
(def reagent-input
(adapt-input-component "input"))
(comp/reactify-component
(adapt-input-component "input")))
(def reagent-textarea
(adapt-input-component "textarea"))
(comp/reactify-component
(adapt-input-component "textarea")))
;;; Conversion from Hiccup forms
@ -260,15 +262,15 @@
(aset tag-name-cache x (parse-tag x))))
(defn native-element [parsed argv first]
(let [comp ($ parsed :name)]
(let [comp ($ parsed :name)
props (nth argv first nil)
hasprops (or (nil? props) (map? props))
jsprops (convert-props (if hasprops props) parsed)
first-child (+ first (if hasprops 1 0))]
(case comp
"input" (reag-element reagent-input argv)
"textarea" (reag-element reagent-textarea argv)
(let [props (nth argv first nil)
hasprops (or (nil? props) (map? props))
jsprops (convert-props (if hasprops props) parsed)
first-child (+ first (if hasprops 1 0))
key (-> (meta argv) get-key)
"input" (react/createElement reagent-input jsprops)
"textarea" (react/createElement reagent-textarea jsprops)
(let [key (-> (meta argv) get-key)
p (if (nil? key)
jsprops
(oset jsprops "key" key))]