From 342d9258b13ce45c2d969a167ac2a46507d6011a Mon Sep 17 00:00:00 2001 From: peng-u-0807 Date: Tue, 5 Dec 2023 17:06:14 +0900 Subject: [PATCH] fix: fix BottomNavigation state being remained when user switched --- .../app/src/main/java/com/goliath/emojihub/views/MainPage.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/android/app/src/main/java/com/goliath/emojihub/views/MainPage.kt b/android/app/src/main/java/com/goliath/emojihub/views/MainPage.kt index 875ea166..f10e4379 100644 --- a/android/app/src/main/java/com/goliath/emojihub/views/MainPage.kt +++ b/android/app/src/main/java/com/goliath/emojihub/views/MainPage.kt @@ -7,6 +7,7 @@ import androidx.compose.material.BottomNavigation import androidx.compose.material.BottomNavigationItem import androidx.compose.material3.Icon import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.painterResource @@ -18,6 +19,10 @@ fun MainPage() { val bottomNavigationController = LocalBottomNavigationController.current val currentRoute = bottomNavigationController.currentDestination.value + LaunchedEffect(Unit) { + bottomNavigationController.updateDestination(PageItem.Feed) + } + Column(Modifier.fillMaxSize()) { Box(Modifier.weight(1f)) { when (currentRoute) {