This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-10-11
Channels
- # aleph (7)
- # bangalore-clj (11)
- # boot (70)
- # cider (11)
- # cljsjs (3)
- # cljsrn (17)
- # clojure (88)
- # clojure-brasil (8)
- # clojure-dev (17)
- # clojure-greece (1)
- # clojure-italy (6)
- # clojure-poland (8)
- # clojure-russia (2)
- # clojure-spec (44)
- # clojure-uk (32)
- # clojurescript (176)
- # cloverage (2)
- # component (5)
- # cursive (3)
- # datomic (23)
- # defnpodcast (6)
- # dirac (15)
- # emacs (6)
- # garden (19)
- # hoplon (126)
- # leiningen (1)
- # off-topic (3)
- # om (66)
- # onyx (56)
- # re-frame (8)
- # reagent (7)
- # ring-swagger (43)
- # specter (18)
- # untangled (110)
- # vim (3)
- # yada (39)
notifying browser that file changed: out/cljstest/core.js
Compiling "target/not-used.js" from ["src" "env/dev"]...
Successfully compiled "target/not-used.js" in 0.306 seconds.
notifying browser that file changed: out/cljstest/core.js
@pesterhazy yes a blog posts about TextInputs would be nice 😄
I had an other problem, because I wanted to have a property to focus a field. It is pretty ugly with reagent to get access to the javascript object of the input element to call focus on it. I ended up with an ugly solution. but maybe with a similar way you could create your own property that you can use to clear the input field: https://gist.github.com/Knotschi/6f97efe89681ac149113ddec4c396cc5
@knotschi this is a little bit less ugly I find: https://gist.github.com/pesterhazy/4d9df2edc303e5706d547aeabe0e17e1
oh, nice, thanks. I totally missed that you can use ref as a callback function instead of a string property. thats indeed much more elegant.
even though the whole thing still feels a bit hacky 😄 unfortunately the react native guys are not willing to add a "focus" attribute to TextInput fields
[touchable-highlight {:style (styles :wrapper)
:on-press #(.alert (.-Alert ReactNative) "Alert Title" "alert-message” (clj->js[{:text "OKd"
:onPress (fn [] (.log console 3))}])}
the alert gets an array of objects, that have text
and onPress
. the second being a function
@pvinis the way you wrote it should work. except maybe not console, but js/console.
here's what I have (for rum though):
(defn alert
([title]
(.alert (.-Alert ReactNative) title))
([title msg]
(.alert (.-Alert ReactNative) title msg))
([title msg buttons]
(.alert (.-Alert ReactNative) title msg (clj->js buttons))))
(defn alert-button
([txt]
#js {:text txt})
([txt on-click]
#js {:text txt :onPress on-click}))
actually, try replacing (clj->js [{...}])
with [#js {..}]
, because:
cljs.user=> (clj->js [{:text "OKd" :onPress (fn [] 3)}])
#js [#js {:text "OKd", :onPress #object[Function "function (){return (3);}"]}]
cljs.user=> [#js {:text "OKd" :onPress (fn [] 3)}]
[#js {:text "OKd", :onPress #object[onPress "function (){return (3);}"]}]