Djuro
04/29/2024, 8:35 AMTopAppBar
and navigation should change depending on the screen that's displayed.
In my `MainActivity`'s setContent
I use DestinationsNavHost
and I pass callbacks to all my functions using destinationsNavigator
. Now, the issue is that I can't access destinationsNavigator in Place where my TopAppBar
is
Theme {
Scaffold(
topBar = {
onIconClicked = {
NAVIGATION SHOULD HAPPEN
}
}
) {
DestinationsNavHost {
composable {}
composable {}
}
}
}
How do I "inject" the navigator in topbar?
Note: one solution I employed is have a topAppBarNavigationLambda
and passing it as state, updating it when navigation happens for each composable
sectionRafael Costa
04/29/2024, 8:52 AMNavController.rememberDestinationsNavigator()
Rafael Costa
04/29/2024, 8:54 AMSuhaib Kazi
04/29/2024, 11:41 AM