I was trying out `InterceptPlatformTextInput` on C...
# compose
e
I was trying out
InterceptPlatformTextInput
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?
Copy code
@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)
h
I believe this was reported here https://issuetracker.google.com/355900176
was solved here r.android.com/3200910
💯 2
❤️ 2
I will try to find whether this fix made it into any 1.7.x release
e
Thank you for looking into it! Could you find when this will land?
Can confirm that this is fixed in CMP 1.8.0-alpha01