Fork me on GitHub
#cljsrn
<
2016-10-07
>
pesterhazy14:10:57

does anyone else have problems with TextInput and reagent?

pesterhazy14:10:02

when I use {:value @my-atom :on-change-text #(reset my-atom %)} I see that the input fields "can't keep up" with my keypresses

pesterhazy14:10:31

i.e. when you type quickly, the field skips over chars

pesterhazy14:10:09

my hypothesis is that this is due to reagent's ratom-based update mechanism

pesterhazy14:10:18

whereas I think if you use react component state as in http://stackoverflow.com/a/35713280/239678, the mechanism works

pesterhazy14:10:17

did you run into this issue @knotschi ?

savelichalex15:10:45

@pesterhazy maybe animated value can help with it?

savelichalex15:10:12

I'm bot sure that this is will work, but you can try. In theory if you use animated value, then they not rerender all, thay just set value over bridge. Wait a minute for snippet

savelichalex15:10:23

But anyway I'm not sure that you can use animated value for textfield value)

savelichalex15:10:50

What I know for sure, that recently I create custom views for ios and android, and used animated api to change value over bridge, instead full render

pesterhazy15:10:15

I'll check it out

pesterhazy15:10:57

Just tried using reagent.core/flush after swapping in the global state values

pesterhazy15:10:07

that seems to mitigate the problem somewhat

pesterhazy15:10:51

it actually works

pesterhazy15:10:13

you need to make sure though to set the value to "" instead of nil when resetting the field

pesterhazy15:10:26

flush seems to fix the issue