nav3-recipes icon indicating copy to clipboard operation
nav3-recipes copied to clipboard

Provide interoperability with Fragments/Views

Open jbw0033 opened this issue 9 months ago • 3 comments

We should show examples of using Fragment and Views via their compose integrations along with Navigation3.

jbw0033 avatar Jul 15 '25 21:07 jbw0033

Can nav3 be used with traditional xml/fragments?

est7 avatar Jul 28 '25 07:07 est7

I'm assuming that interoperability can be achieved by embedding Fragments and Views into Compose. Therefore, the "root" component needs to be a Composable, which holds the NavDisplay. Within the entryProvider one could embedded traditional views.

@jbw0033 Could you confirm if "this is the way"? Or whether there are other concepts planned?

Gabweb avatar Jul 31 '25 16:07 Gabweb

Interoperability with Views and Fragments works fine with, AndroidView and AndroidFragment.

If I embed a Fragment into my screen composable using AndroidFragment, is there any way to obtain the same NavEntry-scoped view model in the Fragment that is used by the other parts of my screen composable?

hannta avatar Aug 13 '25 17:08 hannta