Skip to content

deonmenezes/mobile-app-skill / skills/navigation-3

navigation-3

Verified

Learn how to install and migrate to Jetpack Navigation 3, and how to implement features and patterns such as deep links, multiple backstacks, scenes (dialogs, bottom sheets, list-detail, two-pane, supporting pane), conditional navigation (such as logged-in navigation versus anonymous), returning results from flows, integration with Hilt, ViewModel, Kotlin, and view interoperability.

FileKindSize
SKILL.mdskill md6.5 KB
references/android/guide/navigation/navigation-3/index.mdmarkdown3.5 KB
references/android/guide/navigation/navigation-3/migration-guide.mdmarkdown26.5 KB
references/android/guide/navigation/navigation-3/recipes/animations.mdmarkdown6.4 KB
references/android/guide/navigation/navigation-3/recipes/basic.mdmarkdown3.5 KB
references/android/guide/navigation/navigation-3/recipes/basicdsl.mdmarkdown3.5 KB
references/android/guide/navigation/navigation-3/recipes/basicsaveable.mdmarkdown3.5 KB
references/android/guide/navigation/navigation-3/recipes/bottomsheet.mdmarkdown7.7 KB
references/android/guide/navigation/navigation-3/recipes/common-ui.mdmarkdown8.5 KB
references/android/guide/navigation/navigation-3/recipes/conditional-transitions.mdmarkdown8.4 KB
references/android/guide/navigation/navigation-3/recipes/conditional.mdmarkdown9.4 KB
references/android/guide/navigation/navigation-3/recipes/deeplinks-custommatcher.mdmarkdown7.1 KB
references/android/guide/navigation/navigation-3/recipes/deeplinks-staticuri.mdmarkdown5.5 KB
references/android/guide/navigation/navigation-3/recipes/deeplinks-syntheticbackstack.mdmarkdown7.7 KB
references/android/guide/navigation/navigation-3/recipes/deeplinks-uriarguments.mdmarkdown15.4 KB
references/android/guide/navigation/navigation-3/recipes/dialog.mdmarkdown4.4 KB
references/android/guide/navigation/navigation-3/recipes/lifecycle-owner.mdmarkdown8.2 KB
references/android/guide/navigation/navigation-3/recipes/material-listdetail.mdmarkdown6.4 KB
references/android/guide/navigation/navigation-3/recipes/material-supportingpane.mdmarkdown6.6 KB
references/android/guide/navigation/navigation-3/recipes/modular-hilt.mdmarkdown9.6 KB
references/android/guide/navigation/navigation-3/recipes/modular-koin.mdmarkdown10.3 KB
references/android/guide/navigation/navigation-3/recipes/multiple-backstacks.mdmarkdown16.8 KB
references/android/guide/navigation/navigation-3/recipes/passingarguments.mdmarkdown16.0 KB
references/android/guide/navigation/navigation-3/recipes/results-event.mdmarkdown9.8 KB
references/android/guide/navigation/navigation-3/recipes/results-state.mdmarkdown9.6 KB
references/android/guide/navigation/navigation-3/recipes/scenes-listdetail.mdmarkdown15.9 KB
references/android/guide/navigation/navigation-3/recipes/scenes-twopane.mdmarkdown9.1 KB
references/android/guide/navigation/type-safe-destinations.mdmarkdown4.1 KB

references/android/guide/navigation/navigation-3/recipes/animations.md

View on GitHub
# Animations Recipe

This recipe shows how to override the default animations at the `NavDisplay` level, and at the individual destination level.

## How it works

The `NavDisplay` composable takes `transitionSpec`, `popTransitionSpec`, and `predictivePopTransitionSpec` parameters to define the animations for forward, backward, and predictive back navigation respectively. These animations will be applied to all destinations by default.

In this example, we use `slideInHorizontally` and `slideOutHorizontally` to create a sliding animation for forward and backward navigation.

It is also possible to override these animations for a specific destination by providing a different `transitionSpec` and `popTransitionSpec` to the `entry` composable. In this recipe, `ScreenC` has a custom vertical slide animation.
[![](https://developer.android.com/static/images/picto-icons/code.svg) Explore View the full recipe on GitHub.](https://github.com/android/nav3-recipes/tree/main/app/src/main/java/com/example/nav3recipes/animations)

```
package com.example.nav3recipes.animations


import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.animation.EnterTransition
import androidx.compose.animation.ExitTransition
import androidx.compose.animation.core.tween
import androidx.compose.animation.slideInHorizontally
import androidx.compose.animation.slideInVertically
import androidx.compose.animation.slideOutHorizontally
import androidx.compose.animation.slideOutVertically
import androidx.compose.animation.togetherWith
import androidx.compose.material3.Button
import androidx.compose.material3.Text
import androidx.lifecycle.compose.dropUnlessResumed
import androidx.navigation3.runtime.NavKey
import androidx.navigation3.runtime.entryProvider
import androidx.navigation3.runtime.metadata
import androidx.navigation3.runtime.rememberNavBackStack
import androidx.navigation3.ui.NavDisplay
import com.example.nav3recipes.content.ContentGreen
import com.example.nav3recipes.content.ContentMauve
import com.example.nav3recipes.content.ContentOrange
import com.example.nav3recipes.ui.setEdgeToEdgeConfig
import kotlinx.serialization.Serializable


@Serializable
private data object ScreenA : NavKey

@Serializable
private data object ScreenB : NavKey

@Serializable
private data object ScreenC : NavKey


class AnimatedActivity : ComponentActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        setEdgeToEdgeConfig()
        super.onCreate(savedInstanceState)
        setContent {

            val backStack = rememberNavBackStack(ScreenA)

            NavDisplay(
                backStack = backStack,
                onBack = { backStack.removeLastOrNull() },
                entryProvider = entryProvider {
                    entry<ScreenA> {
                        ContentOrange("This is Screen A") {
                            Button(onClick = dropUnlessResumed { backStack.add(ScreenB) }) {
                                Text("Go to Screen B")
                            }
                        }
                    }
                    entry<ScreenB> {
                        ContentMauve("This is Screen B") {
                            Button(onClick = dropUnlessResumed { backStack.add(ScreenC) }) {
                                Text("Go to Screen C")
                            }
                        }
                    }
                    entry<ScreenC>(
                        metadata = metadata {
                            // Slide new content up, keeping the old content in place underneath
                            put(NavDisplay.TransitionKey) {
                                slideInVertically(
                                    initialOffsetY = { it },
                                    animationSpec = tween(1000)
                                ) togetherWith ExitTransition.KeepUntilTransitionsFinished
                            }

                            // Slide old content down, revealing the new content in place underneath
                            put(NavDisplay.PopTransitionKey) {
                                EnterTransition.None togetherWith
                                        slideOutVertically(
                                            targetOffsetY = { it },
                                            animationSpec = tween(1000)
                                        )
                            }

                            // Slide old content down, revealing the new content in place underneath
                            put(NavDisplay.PredictivePopTransitionKey) {
                                EnterTransition.None togetherWith
                                        slideOutVertically(
                                            targetOffsetY = { it },
                                            animationSpec = tween(1000)
                                        )
                            }
                        }
                    ) {
                        ContentGreen("This is Screen C")
                    }
                },
                transitionSpec = {
                    // Slide in from right when navigating forward
                    slideInHorizontally(
                        initialOffsetX = { it },
                        animationSpec = tween(1000)
                    ) togetherWith slideOutHorizontally(
                        targetOffsetX = { -it },
                        animationSpec = tween(1000)
                    )
                },
                popTransitionSpec = {
                    // Slide in from left when navigating back
                    slideInHorizontally(
                        initialOffsetX = { -it },
                        animationSpec = tween(1000)
                    ) togetherWith slideOutHorizontally(
                        targetOffsetX = { it },
                        animationSpec = tween(1000)
                    )
                },
                predictivePopTransitionSpec = {
                    // Slide in from left when navigating back
                    slideInHorizontally(
                        initialOffsetX = { -it },
                        animationSpec = tween(1000)
                    ) togetherWith slideOutHorizontally(
                        targetOffsetX = { it },
                        animationSpec = tween(1000)
                    )
                }
            )
        }
    }
}
```
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall