From b4ec13f003d560b98724ec24299cc3159ef0503a Mon Sep 17 00:00:00 2001 From: Juho Teperi Date: Tue, 13 Sep 2016 15:15:39 +0300 Subject: [PATCH] Fix #259: Call original ref in ReagentInput --- src/reagent/impl/template.cljs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/reagent/impl/template.cljs b/src/reagent/impl/template.cljs index fc6b0c2..9d907fa 100644 --- a/src/reagent/impl/template.cljs +++ b/src/reagent/impl/template.cljs @@ -174,7 +174,8 @@ (.hasOwnProperty jsprops "value")) (let [v ($ jsprops :value) value (if (nil? v) "" v) - on-change ($ jsprops :onChange)] + on-change ($ jsprops :onChange) + original-ref ($ jsprops :ref)] (when (nil? ($ this :cljsInputElement)) ;; set initial value ($! this :cljsDOMValue value)) @@ -183,7 +184,9 @@ (doto jsprops ($! :defaultValue value) ($! :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] (case x