Questions tagged [jetpack-compose-navigation]

200 questions
55
votes
9 answers

Compose-Navigation: Remove previous composable from stack before navigating

I'm using compose-navigation(alpha09) to handle the navigation between composables I want to remove the Splash screen when moving to the next destination (I don't want the back pressed to get back to Splash) Following attempts did not work as…
27
votes
6 answers

How to pass object in navigation in jetpack compose?

From the documentation, I can pass string, integer etc. But how can I pass objects on navigation? Note: If I set the argument type parcelable then the app crashes with java.lang.UnsupportedOperationException: Parcelables don't support default…
22
votes
1 answer

Jetpack Compose NavHost recomposition composable multiple times

I found out that the composable screens are getting recomposition multiple times during navigation from Navhost compose the following example shows how I'm integrating the navigation with logs to identify how many time the function is getting…
16
votes
6 answers

JetpackCompose Navigation Nested Graphs cause "ViewModelStore should be set before setGraph call" exception

I am trying to apply Jetpack Compose navigation into my application. My Screens: Login/Register screens and Bottom navbar screens(call, chat, settings). I already found out that the best way to do this is using nested graphs. But I keep getting…
16
votes
3 answers

How to share a viewmodel between two or more Jetpack composables inside a Compose NavGraph?

Consider this example. For authentication, we'll be using 2 screens - one screen to enter phone number and the other to enter OTP. Both these screens were made in Jetpack Compose and the for the NavGraph, we are using compose navigation. Also I have…
13
votes
2 answers

Jetpack Compose: Nested navigation with bottom bar navigation in a nested route

My app has the following structure and because Route B has a own bottom navigation bar and thus an own NavHost, how can I navigate from Screen C (opened from the tab bar) to Route A? - Nested Route "/onboarding_route", startDestination = 'start' …
13
votes
4 answers

Navigation destination that matches request NavDeepLinkRequest cannot be found in the navigation graph NavGraph

I have a NavGraph that looks like this: @Composable fun NavGraph ( navController: NavHostController ) { NavHost( navController = navController, startDestination = "Products" ) { composable( route =…
13
votes
4 answers

How to handle back navigation with Jetpack Compose + Navigation (without fragments)

I am trying to navigate lets say from onboarding to dashboard and beyond and pop the onboarding once user hits dashboard, but still with 'back action' I end up on onboarding again. Here is the sample code: @AndroidEntryPoint class MainActivity :…
12
votes
2 answers

How to navigate to a non bottom bar screen with jetpack compose?

So i have an app in compose that has startDestination set as a screen with scaffold with bottom nav bar having 3 items and top app bar, i am able to navigate through the 3 bottom navigation tabs. But suppose i want to click on a card in one of the…
8
votes
3 answers

Compose Navigation : Passing Arguments in Back Stack

I have tried all possible way looks like not getting a solution to this. I am using an all compose app with compose screens and using compose navigation to navigate between this screen, I have a scenario where I am navigating further in this…
8
votes
1 answer

Manually pre-populate navigation backstack in Android/Jetpack Compose

Is it possible to pre-populate the navigation backstack in Android/Jetpack Compose? I have a deeplink, that navigates deep into the navigation hierarchy, however, on back press, it navigates to the root route. Example: Route.Main -> Route.List ->…
8
votes
3 answers

Pass an argument to a nested navigation graph in Jetpack Compose

From the docs, I see you can nest navigation graphs like so: NavHost(navController, startDestination = "home") { ... // Navigating to the graph via its route ('login') automatically // navigates to the graph's start destination -…
7
votes
2 answers

Compose - NavHost recomposition multiple times

During navigation from Navhost, I found out that the composable screens are getting recomposition multiple times. Because of it, my ViewModel is calling API data source multiple times too. @Composable fun MainView() { val scaffoldState =…
7
votes
0 answers

Jetpack Compose Navigation:How to pass an array as an argument?

I have a filter dialog that shows filter options : When I click on "Parent Platform" section I'm navigating to the PlatformsScreen with two arguments. Argument one is parent which is int and the second is platforms which is an array of int : sealed…
7
votes
2 answers

Jetpack compose navigation popUpTo inclusive true not cleared composable screen from backstack

I am using Jetpack Compose ui version 1.3.0-beta08 and navigation compose version 2.4.0-alpha02 and working Bloom app with all new Architecture components. After login success I need to clear all previous compose login screens, but even added…
1
2 3
13 14