with navigation-compose... what is the proper way to structure your nav graph so that a destination can be accessed by several different nested nav graphs?
For example - you're using bottom navigation and each tab is its own nested nav graph. However, you would like to be able to access a "support" screen destination from all of them.
Also, how would you construct a deep link for this "Support" destination that is used in multiple graphs?
Christopher Mederos
10/28/2024, 3:23 AM
Should a unique route be used for the Support page inside each graph instead?
i
Ian Lake
10/28/2024, 4:13 AM
You can reuse the same route in multiple graphs if you want, there was even a recent fix in Navigation (that is in every stable version of Navigation 2.8) to ensure the copy in your current graph is always used when you navigate to that route: https://developer.android.com/jetpack/androidx/releases/navigation#2.8.0-beta07
👍 1
c
Christopher Mederos
10/28/2024, 4:35 AM
nice - Ill give that spin
s
Stylianos Gakis
10/28/2024, 6:59 AM
Also, if you for some reason want the deep link to take you to a specific one of the places you call this destination, you can always have a unique destination for that place, and instead have it call the exact same shared composable.
But otherwise, the module which contains this destination can expose a
fun NavGraphBuilder.profile()
function which you can call from your :app module and put inside any other place, without those other modules having to know anything about it.
Or it can even expose two functions