Is it possible that using the system back while tr...
# compose-android
l
Is it possible that using the system back while transitioning to a screen breaks the navigation? Code on 🧵 (updating from 2.8.0-beta to 2.8.1 fixed this)
Copy code
@Composable
fun PressBackDuringTransition() {
    val navController = rememberNavController()
    NavHost(
        navController = navController,
        startDestination = "screen_one",
    ) {
        composable("screen_one") {
            Box(
                modifier = Modifier
                    .fillMaxSize()
                    .background(Color.White),
                contentAlignment = Alignment.TopCenter,
            ) {
                Button(
                    onClick = {
                        navController.navigate("screen_two")
                    },
                ) {
                    Text(text = "Go to Screen Two")
                }
            }
        }
        composable("screen_two") {
            Box(
                modifier = Modifier
                    .fillMaxSize()
                    .background(Color.White),
                contentAlignment = Alignment.Center,
            ) {
                Button(onClick = { navController.navigate("screen_one") }) {
                    Text(text = "Go to Screen One")
                }
            }
        }
    }
}
s
Which navigation version are you using? They implemented support for seeking the transition back in tandem with system back. But this does seem to not finish the animation properly indeed
l
Yeah, apparently if I remove the transition animation it works. I'm using "2.8.0-beta03"
could it be that?
Yeah, had to update to 2.8.1. Thanks for your comment, it made me realize that there was a newer version 👍
🌟 1