Questions tagged [jetpack-compose-navigation]

200 questions
6
votes
1 answer

Compose side effects + Jetpack navigation + onBackPressed = Stuck navigation

I am having this issue where I have to navigate when given state gets updated after an asynchronous task gets executed. I am doing it like this: At ViewModel.kt fun executeRandomTask() { viewModelScope.launch { runAsyncTask() …
6
votes
1 answer

Hilt with Jetpack Compose Navigation

I checked this info https://developer.android.com/jetpack/compose/libraries#hilt-navigation how to inject ViewModel to a compose screen. For now I implemeted like this for my test app: NavHost( navController = navController, startDestination…
6
votes
1 answer

Jetpack Compose navigation: login screen and different screen with bottom navigation

My goal is to to have a LoginScreen from which I can navigate to an InternalScreen. The InternalScreen should have/be a bottom navigation bar that can navigate to multiple other screens/routes in the internal space. This is what I imagined my…
6
votes
2 answers

Compose Navigation - navigation destination ... is not a direct child of this NavGraph

I am trying to build below navigation for my order management app: manage_orders/manage_orders/{locationId} manage_orders/manage_order_details/{orderId} And here is my navigation code for that: internal sealed class Screen(val route: String) { …
6
votes
0 answers

Compose paging: LazyColumn items method in NavHost in ConstraintLayout causes IllegalStateException: Check failed

I run into a weird error after upgrading compose to 1.0.0-beta08: java.lang.IllegalStateException: Check failed. at androidx.compose.ui.node.OuterMeasurablePlaceable.getLastConstraints-msEJaDk(OuterMeasurablePlaceable.kt:36) at…
5
votes
1 answer

Share viewmodel from activity to compose function using hilt

My app uses hilt and I have some work with LoadManager inside my activity that read contacts using ContentResolver and when I finish work I get the cursor that I send to my viewModel in order to process the data and do some business logic which for…
5
votes
1 answer

Jetpack Compose , mutable state causes infinite recomposition when navigating with NavHost

Here is the code that causes the infinite recomposition problem MainActivity class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) …
5
votes
0 answers

Jetpack Compose navigation state doesn't restore

I'm struggling with the Jetpack Compose navigation. I'm following the NowInAndroid architecture, but I don't have the correct behaviour. I have 4 destinations in my bottomBar, one of them is a Feed-type one. In this one, it makes a call to Firebase…
5
votes
0 answers

Jetpack Compose: Bottom bar and Nested Navigation

I have setup a Bottom Bar in project on Jetpack Compose app with 2 destinations. I have tried to follow the samples from Google. So for example it looks something like this: @Composable fun ExampleBottomBar(navController: NavHostController) { val…
5
votes
2 answers

Jetpack Compose Navigation - Bottom Nav Multiple Back Stack - View Model Scoping Issue

So I have two tabs, Tab A and Tab B. Each tab has its own back stack. I implemented the multiple back stack navigation using code in this google docs val navController = rememberNavController() Scaffold( bottomBar = { BottomNavigation { …
5
votes
0 answers

Are Fragments useless with jetpack compose?

As far as I know, before jetpack-compose, It was good practice to have one single activity and then use multiple fragments for your app. But now jetpack compose offers navigation between jetpack compose functions so do we need fragments now? or we…
5
votes
1 answer

How can I implement Bottom sheet with BottomBar in jetpack compose

So what I am trying to achieve is: A home composable that hosts a BottomNav Bar (Scaffold is used here ) Bottom Nav Bar is attached with 3 other composables Each of the 3 composables has its own lazy column Every item in the 3 lazy columns have a…
5
votes
1 answer

Jetpack Compose + Navigation: rememberSaveable loses state on rotate

I've encountered a strange behavior with Jetpack Compose in combination with Navigation: If you use rememberSaveable inside some navigation composable, then the state is not saved as promised (e.g. it is lost after rotation). Here is a simple…
4
votes
1 answer

How to Avoid onClick callback being called multiple times Jetpack Compose

While testing my app I realized that if a user pressed the FloatingActionButton quickly, several times, the onClick call back could be fired multiple times. In my case, this caused the backstack being popped multiple times, as the onPopBackStack…
4
votes
0 answers

Jetpack Compose Navigation: Showing multipled bottomsheets on top of each other

I'm trying to find a solution for displaying multiple bottom sheets on top of each other to accomodate our UX/Design. Currently been trying with Accompanist and Compose Navigation Reimagined, but to no avail. Seems like the built inner workings of…
1
2
3
13 14