does not support backstack handling automatically, like
FragmentManager
does, and that we would be forced to track backstack behavior ourselves in business logic (which makes more sense, as it’s just so flexible).
Assuming I’m correct about this, is there any documentation or information anywhere that advocates managing backstack logic ourselves in a
@Compose
world? Like representing a backstack like
listOf(screen1, screen2)
? I’m looking to share this info with colleagues rather than argue for it myself haha
p
Pete Doyle
08/04/2020, 6:07 PM
I think I’ve seen mentions of a project called compose-router here, but also AndroidX Navigation will support Compose eventually. I’m building on a pretty normal Activity + Fragments stack using AndroidX Navigation with Compose for each Fragment/Activity. So it’s still possible to take advantage of the existing mechanisms.
z
zak.taccardi
08/04/2020, 6:08 PM
yeah, I’m talking about a
@Compose
world without
Fragment
i
Ian Lake
08/04/2020, 6:27 PM
AndroidX Navigation is indeed coming to Compose in ~weeks. After that, you'd certainly be able to use that in a pure Compose world or write your own thing like you have to do now
🎉 23
z
Zach Klippenstein (he/him) [MOD]
08/04/2020, 6:50 PM
If you just want to manage the backstack yourself, https://github.com/zach-klippenstein/compose-backstack might be helpful. It’s just a composable function that takes a list of “screen” values (the backstack) and a composable function to render a screen. It does basic transition animations and UI state save/restoration for you.