Skip to content
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

Define Custom Properties for all destinations of a Graph #425

Open
hscissors opened this issue May 5, 2023 · 1 comment
Open

Define Custom Properties for all destinations of a Graph #425

hscissors opened this issue May 5, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@hscissors
Copy link

hscissors commented May 5, 2023

Is there any way define custom properties on a graph, and then check them as part of the NavController.currentDestination?

For example:

@RootNavGraph(start = true)
@NavGraph
annotation class UnauthenticatedNavGraph(
    val start: Boolean = false,
    val showBottomNav: Boolean = false //<---- This custom property 
)

and then something like:

val showBottomNav =  if(navController.currentDestination.parent == NavGraphs.UnauthenticatedNavGraph) navController.currentDestination.parent.showBottomNav

Edit: Or if there is a way to do the same for the @Destination annotation, which probably would be better

@raamcosta
Copy link
Owner

No way to do this, no.
Could be a fun idea, although the property would be part of all destinations of the graph and not really of the NavGraph itself, since when using this annotation, some destination could override and pass true as showBottomNav .

@raamcosta raamcosta added the enhancement New feature or request label May 13, 2023
@raamcosta raamcosta changed the title Define Custom Properties of a Graph Define Custom Properties for all destinations of a Graph Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants