navigation-event
하는 일
이 스킬은 Jetpack Compose Android 앱에서 뒤로 가기 제스처를 가로채고 예측형 뒤로 가기 애니메이션을 실행하는 방법을 안내합니다. 탭 같은 중첩 컨테이너와 기존 BackHandler에서 옮기는 방법도 다룹니다. 맞춤 뒤로 가기 동작이 필요한 Android 개발자를 위한 스킬입니다.
사용하는 경우
- ✓Compose 화면에서 뒤로 가기 제스처를 가로채야 할 때.
- ✓Android 앱에 예측형 뒤로 가기 애니메이션을 넣고 싶을 때.
- ✓오래된 BackHandler 코드를 NavigationEvent 라이브러리로 옮겨야 할 때.
스킬 링크
https://github.com/android/skills/blob/main/navigation/navigation-event/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“내 Compose 앱에서 뒤로 가기 제스처를 예측형 애니메이션과 함께 쓰고, 먼저 바텀 시트를 닫게 해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
이 스킬은 액티비티의 디스패처와 Compose 뒤로 가기 핸들러를 설정하고, 각각을 맞는 화면, 탭, 대화상자에 한정합니다. 최신 Android 버전에서 기존 BackHandler 코드를 옮기는 방법도 다룹니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Common guidelines
- For architecture concepts : To understand the foundational architecture, continuous gesture event lifecycles, or class definitions of the Navigation Event library, read Navigation Event overview.
- For Android target : If compile SDK is lower than 36, set it to
36or higher inbuild.gradle.kts. - For Compose Android target: The project must use Jetpack Compose for Compose-specific APIs. This skill is scoped exclusively to Compose Android (Android Views and non-Compose implementations are excluded).
- For activity dispatchers :
ComponentActivityautomatically implementsNavigationEventDispatcherOwnerout-of-the-box. You must use the built-innavigationEventDispatcherwithout creating anonymous delegate owners or overriding member properties. - For dialog scoping : Floating windows (Compose
Dialog,ModalBottomSheet,ComponentDialog) automatically provide aNavigationEventDispatcherOwner. You don't need manualCompositionLocalProviderpropagation for dialogs. - For parent-child dispatcher hierarchies : When scoping navigation handling to
ViewPagers, tabbed interfaces, or nested navigation containers in Compose, userememberNavigationEventDispatcherOwner()to create a child owner linked to the parent. Disabling the owner (enabled = false) automatically cascades to disable all child handlers. - For Compose handlers : A one-to-one relationship between
NavigationEventStateand handlers is strictly enforced. Never bind the sameNavigationEventStateto multiple activeNavigationBackHandlerinstances (IllegalArgumentException).
Step 1: Plan
To complete this step, you MUST ensure the following:
- Identify the target platform : Verify the app is targeting Compose Android. If
compileSdkis lower than 36, set it to36or higher inbuild.gradle.kts. - Navigation check: Check if Navigation 3 is in use. If it is in use, use Navigation 3's built-in back navigation support rather than manually implementing low-level dispatchers from this skill.
- Hierarchy check : Identify host Activities,
ViewPagers, tabbed interfaces, or nested navigation hosts that require back gesture interception or parent-child dispatcher linking. - Migration check : Check if the project is migrating from back handling (
OnBackPressedCallback,BackHandler,onBackPresser) toNavigationEventandNavigationBackHandler. - Input interception : Detect where the app is intercepting navigation events from gestures or hardware button presses requiring translation to
NavigationEvent.
Step 2: Set up dependencies
To complete this step, you MUST ensure the following:
- For setting up compile SDKs, declaring catalog versions, and adding dependencies, follow setup guide.
Step 3: Configure dispatcher and inputs
To complete this step, you MUST ensure the following:
- To configure your dispatcher, leverage automatic
ComponentActivityorComponentDialogowner resolution. - Link parent-child dispatchers in Compose following dispatcher guide.
Step 4: Handle back navigation and UI transitions
To complete this step, you MUST ensure the following:
- To create navigation event handlers, integrate back gesture interception in Compose, animate UI components during swipes, and migrate from legacy back handlers, follow handle back guide.
Step 5: Clean up resources
[!WARNING] Warning: Compose APIs perform teardown automatically. When using Compose APIs such as
NavigationBackHandlerandrememberNavigationEventDispatcherOwner(), handler removal and dispatcher disposal occur automatically when the composable leaves the composition.
You MUST perform explicit manual cleanup only when managing custom dispatchers or non-Compose handlers:
- Call
remove()on active handlers during teardown. - Call
isEnabled = falseto temporarily disable navigation subtrees. - Call
dispose()on dispatcher instances when hosting components are destroyed. Disposing a parent dispatcher automatically cascades to all child dispatchers.
Core troubleshooting guidelines
1. Activity dispatcher setup (StackOverflowError recursion)
ComponentActivity im
자주 묻는 질문
Android Views 앱에도 작동하나요?
아니요. 이 스킬은 Compose Android 앱만 대상으로 하며 Views는 제외됩니다.
필요한 Android 대상 버전은 무엇인가요?
앱의 compile SDK가 36보다 낮으면 스킬이 36 이상으로 올립니다.
대화상자에 추가 설정이 필요한가요?
아니요. 대화상자와 바텀 시트는 자체 디스패처를 제공하므로 추가 연결이 필요하지 않습니다.
상세 정보
작성자의 원본 설명
Intercept back gestures and run Predictive Back animations using the NavigationEvent (androidx.navigationevent) library in Compose Android. Handles Activity setup, parent-child dispatcher scoping in `ViewPagers` or tabs, Compose `NavigationBackHandler`, and migration from legacy `BackHandler` on SDK 36+.
repo: android/skills
인기도
- GitHub 스타
- 10k
- 순위
- #11925
- 라이선스
- Apache-2.0
- 업데이트
- 2026. 10. 29.
댓글
- …
이 저장소의 다른 스킬
agp-9-upgrade
10k에이전트가 Android 앱을 Android Gradle Plugin 9로 업그레이드하고 호환되지 않는 변경 사항을 처리하도록 돕습니다. 멀티플랫폼 프로젝트는 대상이 아닙니다.
camerax
10k에이전트가 CameraX로 동영상 녹화, 하드웨어 제어, ML Kit와 Media3 효과를 포함한 Android 카메라 기능을 만들도록 돕습니다.
android-for-cars-parked-apps
10k에이전트가 Android 동영상, 게임 또는 브라우저 앱을 Android Auto와 Android Automotive의 주차 중 앱으로 실행되도록 맞추는 것을 돕습니다.
appfunctions
10k에이전트가 Android 앱의 핵심 작업 흐름을 찾아, AI 에이전트와 음성 명령이 실행할 수 있는 AppFunctions로 노출하도록 돕습니다.
비슷한 스킬
android-clean-architecture
280k에이전트가 Android 프로젝트를 효율적으로 구성하도록 돕습니다. 유지보수와 새 기능 개발이 쉽도록 코드를 구조화합니다.
compose-multiplatform-patterns
280k에이전트가 KMP 프로젝트에서 Compose Multiplatform과 Jetpack Compose 패턴을 쓰도록 돕습니다. 상태, 내비게이션, 테마, 성능을 다룹니다.
dart-flutter-patterns
280kDart와 Flutter 앱용 코드를 작성하도록 에이전트를 돕습니다. 견고하고 관리하기 쉬운 앱을 만드는 현대적인 패턴을 씁니다.