Deep Linking / Global Navigation

Both Navigator and NavHost can be initialized before they are eventually rendered.

val navigator = rememberNavigator(
    initialize = { navigator -> 
        // Set an initial back stack
    }
)

val navHost = rememberNavHost(
    initialize = { navHost ->
        // Set active entry / update navigators
    }
)

The sample deeplinking example shows one way of handling deeplinking when an activity is created and when a new intent is received while the activity is already created.

The GlobalNavigator example can also be used for global navigation. This is very handy where we want to navigate from a deeply nested area of our navigation hierarchy to another with no direct navigation link.

Last updated