This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-10-22
Channels
- # admin-announcements (29)
- # aws (2)
- # beginners (25)
- # boot (110)
- # business (15)
- # cider (39)
- # cljs-dev (3)
- # clojure (90)
- # clojure-czech (28)
- # clojure-hamburg (1)
- # clojure-japan (24)
- # clojure-poland (149)
- # clojure-russia (46)
- # clojure-sg (9)
- # clojure-uk (6)
- # clojure-ukraine (1)
- # clojurescript (105)
- # core-async (37)
- # cursive (9)
- # dato (7)
- # datomic (6)
- # emacs (10)
- # events (1)
- # hoplon (22)
- # jobs (4)
- # ldnclj (38)
- # leiningen (4)
- # off-topic (17)
- # om (173)
- # onyx (134)
- # re-frame (46)
- # reagent (35)
Hello. Is there any component like textareaautoresize, which works for Reagent? Something like TextareaAutosize which works with Reagent.
I have such a component, but every time I type something my caret position moves to the end of textarea
@abtv - that is a well known issue and happens when the component re-renders on every state change. Typically because a keypress updates an atom that is defined in the render fn. Moving the atom out of the component usually works.
@colin.yates: If I change it to a usual :text-area it works perfect. Can it still be the problem you describe? By the way, my atom created like a closure...
that’s interesting - that it works if text-area. Not sure then - a gist might help others help?
if you mean (defn my-comp [] (let [my-atom (ratom/atom nil)] [:input {:value @my-atom :on-change #(reset! my-atom (-> % .-target .-value)}]))
then yes, that will be a problem - move the atom out of the defn or have the defn return an fn
Is anybody aware of something like this https://github.com/chieffancypants/angular-loading-bar that works with reagent?
@colin.yates: you can see it in action
I think problem can be with my TextareaAutosize.js. Maybe someone has a better alternative?
Ola! Does anyone know if Reagent supports multiple mount points, like:
(reagent/render-component [childcaller]
(.-body js/document "mount-point-1"))
(reagent/render-component [childcaller]
(.-body js/document "mount-point-2”))
(cf https://github.com/reagent-project/reagent/issues/190)
?(╭ರ_•́)
@abtv: I can’t see anything obvious - it is almost certainly in the text-area-react… maybe remove the autosize as well?
@colin.yates: unfortunately I have to implement autosize
@abtv - sorry, out of ideas (and time :-()
There is https://github.com/andreypopp/react-textarea-autosize/blob/master/src/TextareaAutosize.js almost the same component
@colin.yates: thanks anyway
@krisajenkins: It sure does, for me anyway:(defn mount-header [] (reagent/render [header] (.getElementById js/document "header"))) (defn mount-cart [] (reagent/render [cart/page] (.getElementById js/document "cart"))) (defn mount-app [] (reagent/render [current-page] (.getElementById js/document "app")))
@pepe - weird - I wonder if that’s because you’re selecting by ID and I’m selecting by Class. Lemme try that…
Hmm…no. I even selecting by ID I only get one of my targets running (the first).
well thing is I have function mount-root which just calls all those functions, and this function is then called in the exported main function
Hmm…I’m a bit baffled then…I have a similar setup...
Anyway, thanks very much @pepe - if someone has that working, I’m sure I can track down why ours isn’t.
Aha, I think I may have cracked it. Thanks again - just knowing it’s possible is a huge help.
@krisajenkins: great, I am glad to hear it
@krisajenkins yeah definitely possible, ive done same way that @pepe suggests
What's the recommended way of doing smooth, complex animations in Reagent these days? I'm experimenting with react-motion, using [this](https://github.com/ducky427/reagent-motion-demos) as a starting point, but it's harder than I would like.