Nat Strangerweather
01/05/2022, 5:04 PMmattinger
01/05/2022, 5:13 PMNat Strangerweather
01/05/2022, 5:16 PMRafael Costa
01/05/2022, 5:23 PMK Merle
01/05/2022, 5:56 PMNat Strangerweather
01/05/2022, 5:57 PMRafael Costa
01/05/2022, 5:58 PMK Merle
01/05/2022, 5:58 PMRafael Costa
01/05/2022, 5:59 PMRafael Costa
01/05/2022, 5:59 PMRafael Costa
01/05/2022, 5:59 PMRafael Costa
01/05/2022, 6:00 PMRafael Costa
01/05/2022, 6:00 PMNat Strangerweather
01/05/2022, 6:01 PMIan Lake
01/05/2022, 6:34 PMRafael Costa
01/05/2022, 6:37 PMRafael Costa
01/05/2022, 6:38 PMIan Lake
01/05/2022, 6:41 PMIan Lake
01/05/2022, 6:41 PMTransactionTooLargeException cases)Rafael Costa
01/05/2022, 6:42 PMIan Lake
01/05/2022, 6:42 PMIan Lake
01/05/2022, 6:43 PMRafael Costa
01/05/2022, 6:43 PMRafael Costa
01/05/2022, 6:44 PMIan Lake
01/05/2022, 6:45 PMRafael Costa
01/05/2022, 6:48 PMEko Prasetyo
05/23/2022, 5:44 PMDestinationNavHost, first for the main/root navigation and the second for my BottomNavigationBar. The problem is I want to access the root DestinationsNavigator from my BottomNavigation screen, but the DestinationNavigator passed to my BottomNavigation screen is for the child graph, not the root one. So I got "Destination not found" error when doing that. Sorry my question is not clear, I'll comeback with the code.Eko Prasetyo
05/23/2022, 6:00 PMRafael Costa
05/23/2022, 6:01 PMRafael Costa
05/23/2022, 6:02 PMRafael Costa
05/23/2022, 6:03 PM@Destination
@Composable
fun MainScreen(
// compose destinations will provide this for you
rootNavController: NavController
)Rafael Costa
05/23/2022, 6:04 PMrootNavController.navigate(ScreenXDestination) // there is a extension function that receives a DestinationRafael Costa
05/23/2022, 6:06 PMEko Prasetyo
05/23/2022, 6:10 PM@BottomNavGraph(start = true)
@Destination(style = NavigationTransition::class)
@Composable
fun BottomNavScreenX(
navigator: DestinationsNavigator, // bottom nav host
rootNavController: NavController, // root nav host
viewModel: DashboardViewModel = hiltViewModel()
)
I'm sorry, is this what you mean?Rafael Costa
05/23/2022, 6:10 PMDestinationsNavigator instead of NavController ๐ค So yeah, on MainScreen you can also use that instead ๐Rafael Costa
05/23/2022, 6:10 PMRafael Costa
05/23/2022, 6:10 PMRafael Costa
05/23/2022, 6:11 PMRafael Costa
05/23/2022, 6:13 PMBottomNavScreenX, you need to either manually call them, or wrap it in some other type (because, you know, if you request two DestinationsNavigators, Compose destinations has no way of knowing how to provide that to you) and use dependenciesContainerBuilder when calling DestinationsNavHost and pass that new type there as a dependency.Eko Prasetyo
05/23/2022, 6:14 PMRafael Costa
05/23/2022, 6:14 PMclass RootNavController(val value: NavController)
// --------------------------
DestinationsNavHost(
dependenciesContainerBuilder = { //this: DependenciesContainerBuilder<*>
dependency(RootNavController(rootNavController))
}
)Rafael Costa
05/23/2022, 6:15 PMRafael Costa
05/23/2022, 6:15 PMRafael Costa
05/23/2022, 6:15 PM@BottomNavGraph(start = true)
@Destination(style = NavigationTransition::class)
@Composable
fun BottomNavScreenX(
navigator: DestinationsNavigator, // bottom nav host
rootNavController: RootNavController, // root nav host
viewModel: DashboardViewModel = hiltViewModel()
) {
rootNavController.value.navigate(ScreenXDestinatioN)
}Rafael Costa
05/23/2022, 6:17 PMRafael Costa
05/23/2022, 6:18 PMclass RootNavigator(rootNavigator: DestinationsNavigator) : DestinationsNavigator by rootNavigatorRafael Costa
05/23/2022, 6:18 PMDestinationsNavigator instead of NavController and you use that here โ๏ธRafael Costa
05/23/2022, 6:19 PMDestinationsNavigator ๐Rafael Costa
05/23/2022, 6:19 PMrootNavigator.navigate(ScreenXDestination)Rafael Costa
05/23/2022, 6:19 PMEko Prasetyo
05/23/2022, 6:24 PMEko Prasetyo
05/23/2022, 6:33 PM