https://kotlinlang.org logo
#compose
Title
# compose
k

Kshitij Patil

11/29/2020, 2:26 PM
Is there any way to integrate jetpack navigation with navigation compose? Like adding navigation compose as nested navigation in parent navigation or vice versa
@Ian Lake any comments on this?
i

Ian Lake

11/30/2020, 4:04 PM
I don't think I understand what you're asking. Can you explain your use case?
k

Kshitij Patil

11/30/2020, 4:27 PM
I'm doing some crazy stuff 😅 I've FragmentContainerView inside a composable which has its own navigationGraph. I've navigation-compose implemented at the root whose on navigation leads to the Composable I hosting FragmentContainerView. Now when I navigate on this Composable using "next" button and press back, it completely ignores the current navController and conforms to the root navigation instead. I need a way to link both of these navigation graphs so that they're navigatiom between them would be streamlined. At the moment, if I implement this child navigation also with navigation-compose, it works fine.
i

Ian Lake

11/30/2020, 7:12 PM
As I mentioned in this other thread (https://kotlinlang.slack.com/archives/CJLTWPH7S/p1605900589474500?thread_ts=1605897798.472900&cid=CJLTWPH7S), I suspect that the Compose within Fragments use case (i.e., the top level Navigation is done in Fragments and those Fragments contain Compose / Compose Navigation) is much more well understood and bug free than the inverse - fragments within Compose
k

Kshitij Patil

12/02/2020, 7:38 AM
Makes sense. I was doing it to get the transition animation support, things will get a lot easier when that'll be done. It's difficult for me to implement top level navigation using fragments. I've implemented a variant of BottomNavigationView using compose and it's way more easier to handle navigations for that using
if(currentRoute != destination) navigate(...)
of navigation-compose than writing a menu xml and class to adapt that menu (something like
BottomNavigationView
class) for fragments. So there's no way I can link the navigation from two worlds?
2 Views