-
-
Notifications
You must be signed in to change notification settings - Fork 166
Open
Description
Description
Given that CurrentScreen() is not the immediate child of the content of a Navigator, and that the screen of the same class as the currently visible screen (but with different parameters) is pushed onto the navigation stack, the currently visible screen does not update until the stack size increases such that the number of digits used to represent the size changes (i.e 1 -> 10 -> 100).
When navigating back, the same behaviour occurs.
Expected behaviour
The visible screen is updated to the one at the top of the stack when navigating forward or backward.
Environment
- Library:
voyager-navigator - Library Version:
1.1.0-beta03(also reproducible on 1.0.1) - Platform: Android (not multiplatform)
- Compose Version:
2025.05.01 - Kotlin Version:
2.1.21
Minimal reproducible example
class TestScreen(
val number: Int
): Screen {
override val key: ScreenKey = "test-${number}"
@Composable
override fun Content() {
val navigator = LocalNavigator.currentOrThrow
Column(Modifier.windowInsetsPadding(WindowInsets.safeContent)) {
Button(
onClick = { navigator.push(TestScreen(number + 1)) }
) {
Text("${number}")
}
}
}
}
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContent {
// This does not update correctly
Navigator(TestScreen(0)) { navigator ->
Box {
CurrentScreen()
}
}
// // This updates correctly
// Navigator(TestScreen(0)) { navigator ->
// CurrentScreen()
// }
}
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels