New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NavGraphArhs are visible only in "start" destination #633
Comments
Hi! NavGraph args are a bit tricky with official Compose Navigation as well. You need the back stack entry correspondent to the nav graph to make sure you'll have the args. If you navigate directly to another graph screen that is not the start one, the args will also not be there. That's why Compose Destinations APIs return nullable type in this case. So, this is expected and how it works with official navigation library as well. You'll need to adapt to it. |
See also here:
|
So i have to navigate to NavGraphs every time when i want to retrive NavGraphsArgs? Sorry for my english ;/ |
@raamcosta can you tell me how i can do this? #633 (comment) |
You can also get a hold of the Something like this: destinationsNavigator.getBackStackEntry(ProfileNavGraph)?.navGraphArgs<ProfileNavGraphArgs>() |
How about get arguments in ViewModel without pass navigator to ViewModel? |
Here is my SettingsGraphArgs:
Here is my TempLockScreen (with @destination(SettingsGraph)):
Here is my SettingsScreen (with @destination(SettingsGraph) AND with start=true flag):
ViewModel of SettingsScreen:
I use this code to navigate to Graph
navigator.navigate( SettingsNavGraph(SettingsGraphArgs(userCard = currentCard.owner)) )
My NavGraphs arguments is empty when i try to get it from TempLockScreen but is visible from SettingsScreen.
Is something what i am doing bad?
The text was updated successfully, but these errors were encountered: