navigation-3

Migrate Android apps from Navigation 2 to Jetpack Navigation 3 and implement Compose navigation patterns.

3|Updated Aug 4, 2024
One-click install
npx skills add https://github.com/kabindra-shrestha/Clean-Architecture-Kotlin-Compose-Multiplatform --skill navigation-3-kabindra-shrestha
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: navigation-3
Source: https://github.com/kabindra-shrestha/Clean-Architecture-Kotlin-Compose-Multiplatform/tree/main/.agents/skills/navigation/navigation-3
Command: npx skills add https://github.com/kabindra-shrestha/Clean-Architecture-Kotlin-Compose-Multiplatform --skill navigation-3-kabindra-shrestha

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Migrating an Android app from Jetpack Navigation 2 to Navigation 3 involves many coordinated changes—dependencies, NavKey routes, back stack state holders, entryProvider DSL, and replacing NavHost with NavDisplay—and developers also need working patterns for dialogs, bottom sheets, deep links, and adaptive layouts. ## Core Features & Use Cases - Step-by-step migration guide: Covers dependency updates, NavKey route conversion, NavigationState and Navigator classes, entryProvider migration, and NavDisplay replacement. - Ready-made recipes: Code examples for multiple back stacks, dialogs, bottom sheets, list-detail and two-pane scenes, conditional navigation, deep links, animations, ViewModel argument passing, and returning results. - Architecture integration: Demonstrates modularized navigation with Hilt or Koin and Material 3 Adaptive layouts. - Use Case: An Android developer with a Compose app using string-based routes can first migrate to type-safe destinations, then follow the guide to replace NavController and NavHost with Navigation 3's back stack model. ## Quick Start Migrate my Android app from Navigation 2 to Navigation 3 using the official migration guide.

Frequently Asked Questions about navigation-3

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I migrate from Navigation 2 to Navigation 3?

Add the navigation3-runtime and navigation3-ui dependencies, make routes implement NavKey, create NavigationState and Navigator classes, move destinations from NavHost's NavGraph into an entryProvider, replace NavHost with NavDisplay, then remove Navigation 2 dependencies.

How do I show a dialog or bottom sheet destination in Navigation 3?

Add DialogSceneStrategy or a custom BottomSheetSceneStrategy to NavDisplay's sceneStrategies parameter, then mark the destination's entry with DialogSceneStrategy.dialog() or BottomSheetSceneStrategy.bottomSheet() metadata.

What are the requirements for migrating to Navigation 3?

You need compileSdk 36 or later, minSdk 23, composable destinations, and strongly typed routes. String-based routes must first be migrated to type-safe navigation using Kotlin serialization before starting the Navigation 3 migration.

Does Navigation 3 support Fragments or Views?

Navigation 3 is designed exclusively for Compose, so destinations must be composable functions. To use Fragments and Views, you must wrap them using Compose interoperability APIs for views in Compose.

What Navigation 2 features are not covered by the migration guide?

The guide does not cover more than one level of nested navigation, shared destinations that move between back stacks, custom destination types, or deep links. Deep links are addressed separately in dedicated basic and advanced recipes.

How do I pass navigation arguments to a ViewModel in Navigation 3?

Add the lifecycle-viewmodel-navigation3 add-on library and construct the ViewModel with viewModel() inside the entry. Navigation arguments are available directly from the NavKey passed to the entry's trailing lambda.