Erik Ziegler
10/17/2024, 4:21 PMInterceptPlatformTextInput
on Compose Multiplatform 1.7.0 and notices something when trying to make a text field where the keyboard does not open. If the keyboard is opened once, e.g. via a text field without interception, the keyboard also opens on the text field that has interception, but only on the second tap.
Anyone having experience with this behaviour?
@OptIn(ExperimentalComposeUiApi::class)
@Composable
fun App() {
var text by remember { mutableStateOf("Hello, world!") }
var text2 by remember { mutableStateOf("Hello, world!") }
MaterialTheme {
Column(
Modifier.fillMaxWidth().padding(20.dp),
verticalArrangement = Arrangement.spacedBy(20.dp),
) {
Column {
Text("Text Field with Interception")
InterceptPlatformTextInput(
interceptor = { request, nextHandler ->
awaitCancellation()
},
) {
BasicTextField(
value = text,
onValueChange = { text = it },
modifier = textFieldStyle,
)
}
}
Column {
Text("Standard Text Field")
BasicTextField(
value = text2,
onValueChange = { text2 = it },
modifier = textFieldStyle,
)
}
Spacer(Modifier.weight(1F))
}
}
}
val textFieldStyle = Modifier
.fillMaxWidth()
.border(1.dp, Color.Black)
.padding(16.dp)
Erik Ziegler
10/17/2024, 4:25 PMHalil Ozercan
10/17/2024, 4:27 PMHalil Ozercan
10/17/2024, 4:27 PMHalil Ozercan
10/17/2024, 4:28 PMErik Ziegler
10/21/2024, 12:59 PMErik Ziegler
12/07/2024, 4:48 PM