navigation-event
Installation
SKILL.md
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.