There seems to be a runtime crash with Compose WASM with
TextField
in Material2 (haven't tested Material3) in 1.4.1, on recomposition when changing themes and used in a
Surface
. Code snippet below should repro the crash in browser:
var useDarkTheme by remember { mutableStateOf(false) }
var text by remember { mutableStateOf("Hello") }
MaterialTheme(
colors = if (useDarkTheme) darkColors() else lightColors()
) {
Surface {
TextField(
value = text,
onValueChange = { text = it },
label = { Text("Label") }
)
Button(onClick = { useDarkTheme = !useDarkTheme }) {
Text("Toggle theme")
}
}
}
It works fine if you don't change colors on the fly, which is odd. Also this happens with
BasicTextField
so it's likely a deeper issue than the Material layer. Is this a known issue?