Skip to content

Commit

Permalink
fix: fix BottomNavigation state being remained when user switched
Browse files Browse the repository at this point in the history
  • Loading branch information
peng-u-0807 committed Dec 5, 2023
1 parent ae676eb commit 342d925
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down

0 comments on commit 342d925

Please sign in to comment.