16

I am trying to type text into a text field in interactive mode and it's not working. But, doing it on a physical device works.

MainActivity.kt

@Preview(showSystemUi = true)
@Composable
fun HelloContentPreview()
{
    HelloContent()
}


@Composable
fun HelloContent()
{
    Column(modifier = Modifier.padding(16.dp)) {
        var name by remember { mutableStateOf("") }
        Text(
            text = "Hello! $name",
            modifier = Modifier.padding(bottom = 8.dp),
            style = MaterialTheme.typography.h5
        )
        OutlinedTextField(
            value = name,
            onValueChange = {
                name = it
                Log.i(TAG, "HelloContent: onValueChange: $it")
            },
            label = { Text("Name") }
        )
    }
}

Interactive mode enter image description here

3

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.