1

I want to trigger a function upon my TextField's focus-gain, but I am unable to find something like a listener.

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
Richard Onslow Roper
  • 5,477
  • 2
  • 11
  • 42

1 Answers1

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