hi everyone… just a question which I didn’t find a...
# compose
a
hi everyone… just a question which I didn’t find any answers in the internet… is there a way to do navigation in Compose without the Jetcpack Compose Navigation component? I would like to learn the “native” way to do navigation in Compose before moving to Navigation component… I didn’t find any articles/questions in StackOverflow or anything else that talks about this
k
That's the native way you're looking for, from the team that works on core Compose
c
Not quite sure what you're asking, but the source code for it is available so you could always use that as inspiration to implement your own
i
Yep, Navigation Compose is built on the same set of public APIs that any Compose app has available to them, so there's a number of navigation related libraries available right now from third party developers
a
Is there any documentation about those APIs? Or if you have the names of some of those libraries so I can take a look, that would be a huge help
i
I'm not sure what APIs you are expecting; it is all just state
Perhaps the only 'navigation' specific thing you'd want to look at it with handling the system back button: https://developer.android.com/jetpack/compose/libraries#handling_the_system_back_button
But if you're looking at how the official samples work as well as many of the public examples of Compose that go beyond just a single screen, you'll find it important to understand how Navigation Compose works, hence why the docs for Navigation Compose are right alongside the other core Compose docs https://developer.android.com/jetpack/compose/navigation
a
I was trying to understand if there is some specific API to navigate between composables but (as you mention) what I understand is that you render screen A or B or wathever screen you want dependent on the state of your app… and the “navigation” part here should be managing the back button and managing the backstack manually if you choose to not use the Compose Navigation library… is that ok?
i
Yeah, the API for navigating between composables is the exact niche that Navigation Compose provides - that's why it exists 🙂 Yes, if you wanted to build your own navigation system, there's lots of things you might want to handle from state saving, lifecycle, the system back button, deep linking, transitions, etc.
a
oh ok… yeah that was the missing part for me, I was expecting something like “goToComposable” API or something like that where I can see how the system saves state and handles back stack and all that but now that I think about it, it doesn’t make any sense… thank you very much for the explanations Ian
a
a
thanks @Arthur Artikov