I want to trigger a function upon my TextField
's focus-gain, but I am unable to find something like a listener.
Asked
Active
Viewed 690 times
1

Gabriele Mariotti
- 320,139
- 94
- 887
- 841

Richard Onslow Roper
- 5,477
- 2
- 11
- 42
-
I don't think using ```Modifier.focusable()``` on a ```TextField``` would be an appropriate choice, since it is already focusable. – Richard Onslow Roper Jul 20 '21 at 13:32
1 Answers
5
You can use the onFocusChanged
modifier
TextField(
value = text,
onValueChange = { text = it},
modifier = Modifier.onFocusChanged {
if (it.isFocused){
//...
}
}
)

Gabriele Mariotti
- 320,139
- 94
- 887
- 841