Gavin
10/14/2020, 10:56 PMTextField
and related components.
I couldn't find a way to filter between an onFocus/blur event vs actual typing/keyboard actions. The onValueChange
handler is firing when I click in and out of the TextField and causes some un-wanted side effects. Am I missing something or is there currently a way (or a way around) to only account for keyboard actions and ignore focus/blur actions?Ralston Da Silva
10/21/2020, 12:04 AM@Composable
fun TextChangedSample(){
var value = remember { TextFieldValue("Initial Text") }
TextField(
value = value,
onValueChange = {
if (value.text != it.text) {
// Add your logic here.
// This will only run when the value has changed.
}
// Don't forget this, this is an important part of
// the TextField API. The developer decides if they
// want to accept the text that was entered.
value = it
}
)
}
Gavin
10/21/2020, 5:39 PMonBlur
or onFocus
handler. There doesn't seem to be one here so Im curious if I just missed something or how I can get around this.Ralston Da Silva
10/22/2020, 10:07 PMGavin
10/23/2020, 9:47 PMRalston Da Silva
10/23/2020, 10:20 PMGavin
10/24/2020, 12:19 AM