HomeScreen: Add static key for TabNavigator (#10191)

Fixes incorrect tab selection after process death
This commit is contained in:
Ivan Iskandar 2023-11-29 22:43:21 +07:00 committed by GitHub
parent e22eebfd02
commit 8ff2c01bf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -66,6 +66,7 @@ object HomeScreen : Screen() {
private val showBottomNavEvent = Channel<Boolean>() private val showBottomNavEvent = Channel<Boolean>()
private const val TabFadeDuration = 200 private const val TabFadeDuration = 200
private const val TabNavigatorKey = "HomeTabs"
private val tabs = listOf( private val tabs = listOf(
LibraryTab, LibraryTab,
@ -80,6 +81,7 @@ object HomeScreen : Screen() {
val navigator = LocalNavigator.currentOrThrow val navigator = LocalNavigator.currentOrThrow
TabNavigator( TabNavigator(
tab = LibraryTab, tab = LibraryTab,
key = TabNavigatorKey,
) { tabNavigator -> ) { tabNavigator ->
// Provide usable navigator to content screen // Provide usable navigator to content screen
CompositionLocalProvider(LocalNavigator provides navigator) { CompositionLocalProvider(LocalNavigator provides navigator) {