I have some OutlinedTextFields and I would like to...
# compose
s
I have some OutlinedTextFields and I would like to know which is currently on Focus. Is there a good way to achieve that?
k
Try this
Copy code
val interactionSource = remember { MutableInteractionSource() }
val focused = interactionSource.collectIsFocusedAsState()
OutlinedTextField(
    value = text,
    onValueChange = { text = it },
    interactionSource = interactionSource
)
If you need more know more, you can observe
InteractionSource.interactions
directly
s
Which compose version do you use for this?
k
I am on beta05 right now, but these functions and classes should have existed for some time