valentine
05/24/2026, 8:43 PMBottomBar, but each Screen needs its own TopBar. I tried doing this using LocalCompositionProvider, but it created a race condition: the closed Screen rendered the TopBar after the open Screen.Ernestas
05/25/2026, 4:25 AMbottomBar? This is 99% of the apps I build, there's a screen that hosts the bottomBar and handles navigation between tabs. Each screen has their own scaffold and their own topBar.valentine
05/25/2026, 6:11 AMBottomBar is shared across all sections, but all other content, including the TopBar, dynamically switches depending on the selected tab. I considered creating a nested Scaffold, but as far as I know, it could cause a performance hit.Ernestas
05/25/2026, 6:16 AMbottomBar currently? I have a DashboardScreen that hosts the bottomBar, and then each screen (eg.: MenuScreen) has their own topBar.
@Composable
private fun DashboardScreen(
navController: NavHostController,
<...>
) {
Column(modifier = modifier) {
BottomNavigationHost(navController = navController)
BottomNavigationBar(
items = viewData.items,
selectedItem = viewData.selectedItem,
onClick = { onAction(DashboardAction.SelectBottomNavigationItem(it)) },
)
}
}
@Composable
private fun MenuScreen(
<...>
) {
Scaffold(
topBar = { ... }
)
}valentine
05/25/2026, 6:23 AMColumn?Ernestas
05/25/2026, 6:24 AMvalentine
05/25/2026, 6:34 AMBottomBar be positioned inside the Scaffold for it to be positioned correctly? I currently have a HostScren like this.
@Composable
fun HostScreen(
modifier: Modifier = Modifier
) {
Scaffold(
bottomBar = {
SharedBottomBar(
// params
)
}
) {
NavHost(
// params
)
}
}Ernestas
05/25/2026, 6:36 AMColumn(modifier = modifier) {
BottomNavigationHost(
<...>
modifier =
Modifier
.weight(1f)
.consumeWindowInsets(WindowInsets.navigationBars),
)
BottomNavigationBar(...)
}Ryan Payne
05/26/2026, 1:45 AMvalentine
05/26/2026, 7:37 AMRyan Payne
05/26/2026, 3:50 PM