https://kotlinlang.org logo
#compose
Title
# compose
f

FunkyMuse

01/13/2022, 8:35 AM
hey guys, is there something like
Copy code
afterTextChanged
for TextInputField in compose?
a

Alex

01/13/2022, 9:59 AM
What do you want to do?
f

FunkyMuse

01/13/2022, 11:21 AM
Execute search only after the user has stopped typing
s

Stylianos Gakis

01/13/2022, 2:47 PM
There’s
onValueChange
no? Doesn’t that suffice?
a

Alex

01/13/2022, 3:07 PM
you can use onValueChange together with a debounce of 500ms
f

FunkyMuse

01/13/2022, 3:20 PM
@Alex that's what i ended up doing @Stylianos Gakis that is triggered on every key stroke
s

Stylianos Gakis

01/13/2022, 3:23 PM
Yeah I mean how would it know when it was the last key by itself? All keys are the “last key” until they are not.
think smart 4
c

Colton Idle

01/13/2022, 5:43 PM
Compose also doesn't use *Changed specifically as names. It uses present tense in order to convey that nothing actually changes until you, the developer, update the state yourself to change. it was in one of the docs. def one of my favorite little details. I try myself to write all events as present tense as well.
8 Views