Skip to content

Commit

Permalink
Fixed issue with sample bottom bar
Browse files Browse the repository at this point in the history
  • Loading branch information
raamcosta committed Sep 8, 2024
1 parent d03907c commit 52399eb
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ import androidx.compose.material.BottomNavigationItem
import androidx.compose.material.Icon
import androidx.compose.material.Text
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.List
import androidx.compose.material.icons.automirrored.filled.List
import androidx.compose.material.icons.filled.Person
import androidx.compose.material.icons.filled.Settings
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.stringResource
import androidx.navigation.NavHostController
import com.ramcosta.composedestinations.utils.isRouteOnBackStack
import com.ramcosta.composedestinations.utils.isRouteOnBackStackAsState
import com.ramcosta.composedestinations.utils.rememberDestinationsNavigator
import com.ramcosta.destinations.sample.NavGraphs
import com.ramcosta.destinations.sample.R
Expand All @@ -29,7 +30,7 @@ fun BottomBar(
val navigator = navController.rememberDestinationsNavigator()
BottomNavigation {
BottomBarItem.values().forEach { destination ->
val isCurrentDestOnBackStack = navController.isRouteOnBackStack(destination.direction)
val isCurrentDestOnBackStack by navController.isRouteOnBackStackAsState(destination.direction)
BottomNavigationItem(
selected = isCurrentDestOnBackStack,
onClick = {
Expand Down Expand Up @@ -72,7 +73,7 @@ enum class BottomBarItem(
val icon: ImageVector,
@StringRes val label: Int
) {
TaskList(TaskListScreenDestination, Icons.Default.List, R.string.task_list_screen),
TaskList(TaskListScreenDestination, Icons.AutoMirrored.Filled.List, R.string.task_list_screen),
Account(AccountScreenDestination, Icons.Default.Person, R.string.account_screen),
Settings(SettingsScreenDestination, Icons.Default.Settings, R.string.settings_screen)
}

0 comments on commit 52399eb

Please sign in to comment.