Skip to content

Commit

Permalink
Merge pull request #101 from snuhcs-course/fix/android-initialize-bot…
Browse files Browse the repository at this point in the history
…tom-nav

Fix BottomNavigation state being remained when user switched
  • Loading branch information
yangchanhk98 authored Dec 5, 2023
2 parents ae676eb + 342d925 commit af012a4
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 af012a4

Please sign in to comment.