Skip to content

How to have a child stack for each BottomNavigationItem with compose? #510

Answered by arkivanov
casaflowa asked this question in Q&A
Discussion options

You must be logged in to vote

It looks like you are following the article A comprehensive thirty-line navigation for Jetpack/Multiplatform Compose
. There is a known issue in the article - nested navigation is not working. Unfortunately, I did not have free time to update the article.

The issue can be fixed by properly remembering the Child Stack, which can be done in different ways. You can choose what you like best.

  1. Use retained ComponentContext and InstanceKeeper.

Create the root ComponentContext as follows:

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.arkivanov.decompose.retainedComponent

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState:

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@casaflowa
Comment options

Answer selected by casaflowa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants