Fudge
07/16/2020, 1:35 PMTextField
unfocus? I can't draw focus away not by tapping outside, or by tapping the IME action on the keyboard, and I can't find a way to do it in code (something like a FocusNode I get from the TextField
that I can call unfocus()
on)
I've found some outdated discussion about it: https://kotlinlang.slack.com/archives/CJLTWPH7S/p1584069025456900?thread_ts=1584053267.453300&cid=CJLTWPH7SSiyamed
07/16/2020, 10:38 PMMadhava
07/16/2020, 10:46 PMRalston Da Silva
07/16/2020, 11:30 PM@Composable
fun Sample() {
var text by savedInstanceState { "" }
val hostView = ViewAmbient.current
Row(modifier = Modifier.tapGestureFilter { hostView.clearFocus() }) {
TextField(value = text,
onValueChange = { text = it },
label = { Text("Enter Text Here") }
)
}
}