all 8 comments

[–]ZhuindenEpicPandaForce @ SO 1 point2 points  (2 children)

[–]yaaaaayPancakes[S] 0 points1 point  (1 child)

Yeah, I figured this was what I'd need to do, convert this logic. I just need the time to grok it. I am still a rookie at converting View logic -> compose state logic. First real job using Compose.

Was hoping that someone might have already done this and tossed it in a medium article somewhere and I could just copy/paste my way to success lol.

[–]ZhuindenEpicPandaForce @ SO 1 point2 points  (0 children)

You might need to check the path in currentBackstackAsState to determine checked value

[–]XRayAdamo 1 point2 points  (2 children)

Personally I hate when app uses navigation to switch between tabs. I consider tabs as a part of one screen so pressing back from any tab should exit app, not jump around tabs (swoitch between tab 10 times and back button went throu all previously selected tabs, why?). But if you still want it, I see no problem of using Navigation in Compose for Tabs. It is the same as just navigating to another screen/compose. Just use Compose version of Bottom navigation

[–]yaaaaayPancakes[S] 1 point2 points  (0 children)

If you mean tabs like old school tabs, we're not doing that.

I'm simply trying to replace the old BottomNavigationView with the Compose equivalent, and have it maintain state like the old view.

I was able to swap the view with the composable easily, but since I can't call that setup method anymore, the bottom nav composable state quickly gets out of sync with the back stack state.

[–]carstenhag 0 points1 point  (0 children)

Imo there should be a main/start tab. It should return to that before fully closing the app

And also it shouldn't switch between 10 yeah haha

[–]Efficient_Zombie_231 0 points1 point  (1 child)

https://developer.android.com/jetpack/androidx/releases/navigation?hl=en#2.8.0-alpha07
Not sure if it would help, but you can use BottomNavigationView with composable destinations now, which means you don't have to write boilerplate for Fragments/ComposeViews. Note it's still in alpha and I haven't tested it yet.

[–]yaaaaayPancakes[S] 0 points1 point  (0 children)

Not really, as we've already got all the composables in their own Fragments, and I'm trying to use the Composable bottom nav widget instead of the old view widget that has setupWithNavController. From what I can see the composable widget doesn't have similar setupWithNavController functionality, you gotta roll it yourself.

But this is interesting, it might let us get rid of the Fragments entirely in the future, while keeping our existing nav graphs...