https://kotlinlang.org logo
#compose-ios
Title
# compose-ios
m

Max

03/24/2024, 1:19 PM
Hey everyone, I’m using the most simple TextField in Compose. Android works. on iOS it always crashes my app/screen when i tap into the field to write something. Getting the message attached. My code:
Copy code
val textState = remember { mutableStateOf(TextFieldValue()) }
TextField(
    value = textState.value,
    onValueChange = { textState.value = it }
)
Does anyone have an idea what is wrong?
compose = "1.6.2"
compose-plugin = "1.6.0"
kotlin = "1.9.22"
I found out that this is not a Compose iOS issue directly, but an issue in the
Voyager
navigation sdk. When nesting two Navigator inside each other, then something weird happens leading to above crash when using TextFields. The below code is inside a
Screen
. Will probably migrate away from Voyager then
Copy code
Navigator(currentContent) {
    val state by screenModel.isLoggedIn.collectAsState(initial = null)
    when (state) {
        true -> it.replaceAll(HomeTabsScreen())
        false -> it.replaceAll(LoginScreen())
        else -> it.replaceAll(SplashScreen())
    }

    CurrentScreen()
}