Skip to content

Instantly share code, notes, and snippets.

@raamcosta
Last active January 8, 2022 22:52
Show Gist options
  • Save raamcosta/ddefc9bad530893044f0b8d0e49e8b76 to your computer and use it in GitHub Desktop.
Save raamcosta/ddefc9bad530893044f0b8d0e49e8b76 to your computer and use it in GitHub Desktop.
// Just as an example of something you might want to send to some destinations
val scaffoldState = rememberScaffoldState()
DestinationsNavHost(
navGraph = NavGraphs.root
) {
composable(SomeScreenDestination) { //this: DestinationScope<SomeScreenDestination.NavArgs>
SomeScreen(
arg1 = navArgs.arg1, // navArgs is a lazily evaluated `SomeScreenDestination.NavArgs` instance, field of `DestinationScope`
navigator = destinationsNavigator, // destinationsNavigator is a `DestinationsNavigator` (also lazily evaluated)
backStackEntry = navBackStackEntry, // navBackStackEntry is a `DestinationScope` field
scaffoldState = scaffoldState,
)
}
//All screens that don't need the scaffoldState don't need to be specified here
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment