Fix #259: Call original ref in ReagentInput

This commit is contained in:
Juho Teperi 2016-09-13 15:15:39 +03:00
parent b4c9b4d537
commit b4ec13f003
1 changed files with 5 additions and 2 deletions

View File

@ -174,7 +174,8 @@
(.hasOwnProperty jsprops "value")) (.hasOwnProperty jsprops "value"))
(let [v ($ jsprops :value) (let [v ($ jsprops :value)
value (if (nil? v) "" v) value (if (nil? v) "" v)
on-change ($ jsprops :onChange)] on-change ($ jsprops :onChange)
original-ref ($ jsprops :ref)]
(when (nil? ($ this :cljsInputElement)) (when (nil? ($ this :cljsInputElement))
;; set initial value ;; set initial value
($! this :cljsDOMValue value)) ($! this :cljsDOMValue value))
@ -183,7 +184,9 @@
(doto jsprops (doto jsprops
($! :defaultValue value) ($! :defaultValue value)
($! :onChange #(input-handle-change this on-change %)) ($! :onChange #(input-handle-change this on-change %))
($! :ref #($! this :cljsInputElement %1)))))) ($! :ref (fn [el]
(if original-ref (original-ref el))
($! this :cljsInputElement el)))))))
(defn ^boolean input-component? [x] (defn ^boolean input-component? [x]
(case x (case x