You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a HomeScreen(mainGraph) and FilterScreen(rootGraph). I need get result back to MainScreen. Here is what i have:
class RootDestinationsNavigator(value: DestinationsNavigator = FakeNavigator()) : DestinationsNavigator by value
class ParentBackNavigator(navigator: ResultBackNavigator) : ResultBackNavigator by navigator
@destination @composable
fun MainScreen(
rootNavController: NavController,
backNavigator: ResultBackNavigator
) {
val navController = rememberNavController() // 👉this will be bottomBar's NavController
DestinationsNavHost(
defaultTransitions = DefaultSlideAnimation,
navGraph = NavGraphs.main,
navController = navController,
dependenciesContainerBuilder = {
// 👉 pass it to all destinations of bottomBar who need it
dependency(RootDestinationsNavigator(rootNavController.rememberDestinationsNavigator()))
dependency(ParentBackNavigator(backNavigator))
}
)
}
I get error on compile time "IllegalDestinationsSetup: Composable 'FilterScreen' must receive a ResultBackNavigator of type 'Boolean' in order to be used as result originator for 'HomeScreen"
The text was updated successfully, but these errors were encountered:
I have a HomeScreen(mainGraph) and FilterScreen(rootGraph). I need get result back to MainScreen. Here is what i have:
class RootDestinationsNavigator(value: DestinationsNavigator = FakeNavigator()) : DestinationsNavigator by value
class ParentBackNavigator(navigator: ResultBackNavigator) : ResultBackNavigator by navigator
@destination
@composable
fun MainScreen(
rootNavController: NavController,
backNavigator: ResultBackNavigator
) {
val navController = rememberNavController() // 👉this will be bottomBar's NavController
DestinationsNavHost(
defaultTransitions = DefaultSlideAnimation,
navGraph = NavGraphs.main,
navController = navController,
dependenciesContainerBuilder = {
// 👉 pass it to all destinations of bottomBar who need it
dependency(RootDestinationsNavigator(rootNavController.rememberDestinationsNavigator()))
dependency(ParentBackNavigator(backNavigator))
}
)
}
@destination
@composable
fun FilterScreen(
resultNavigator: ParentBackNavigator,
viewModel: FilterViewModel = koinViewModel()
) {..}
@destination(start = true)
@composable
fun HomeScreen(
rootDestinationsNavigator: RootDestinationsNavigator,
resultContract: ResultRecipient<FilterScreenDestination, Boolean>,
viewModel: HomeViewModel = koinViewModel()
) {
resultContract.onResult {
if (it)
viewModel.refresh()
}}
I get error on compile time "IllegalDestinationsSetup: Composable 'FilterScreen' must receive a ResultBackNavigator of type 'Boolean' in order to be used as result originator for 'HomeScreen"
The text was updated successfully, but these errors were encountered: