NavigationState

@Serializable
data class NavigationState(val currentEntry: NavigationEntry, val backStack: List<NavigationEntry>, val screenRetentionDuration: Duration, val derived: NavigationProjection, val activeModalContexts: Map<String, ModalContext>, val lastNavigationAction: NavigationAction? = null, val pendingNavigation: PendingNavigation? = null, val isBootstrapping: Boolean = true, val isEvaluatingNavigation: Boolean = false, val activeScrub: ScrubState? = null, val startFailure: StartFailure? = null, val windowWidthClass: WindowWidthClass? = null) : ModuleState(source)

Immutable snapshot of the navigation system's runtime state.

Everything that is a pure function of the back stack is grouped into derived and exposed here under its own name, so navState.visibleLayers reads the same as it always did.

Example - check current location in Compose:

val navState by selectState<NavigationState>().collectAsState()
if (navState.isInGraph("auth")) { ... }
if (navState.isAtPath("home/dashboard")) { ... }

Constructors

Link copied to clipboard
constructor(currentEntry: NavigationEntry, backStack: List<NavigationEntry>, screenRetentionDuration: Duration, derived: NavigationProjection, activeModalContexts: Map<String, ModalContext>, lastNavigationAction: NavigationAction? = null, pendingNavigation: PendingNavigation? = null, isBootstrapping: Boolean = true, isEvaluatingNavigation: Boolean = false, activeScrub: ScrubState? = null, startFailure: StartFailure? = null, windowWidthClass: WindowWidthClass? = null)
constructor(currentEntry: NavigationEntry, backStack: List<NavigationEntry>, lastNavigationAction: NavigationAction?, screenRetentionDuration: Duration, visibleLayers: List<NavigationEntry>, currentFullPath: String, currentGraphHierarchy: List<String>, breadcrumbs: List<NavigationBreadcrumb>, isCurrentModal: Boolean, isCurrentScreen: Boolean, hasModalsInStack: Boolean, contentLayerEntries: List<NavigationEntry>, globalOverlayEntries: List<NavigationEntry>, systemLayerEntries: List<NavigationEntry>, underlyingScreen: NavigationEntry?, modalsInStack: List<NavigationEntry>, activeModalContexts: Map<String, ModalContext>, underlyingScreenGraphHierarchy: List<String>? = null, pendingNavigation: PendingNavigation? = null, isBootstrapping: Boolean = true, isEvaluatingNavigation: Boolean = false, showsNavigationChrome: Boolean = true, activeScrub: ScrubState? = null)

Properties

Link copied to clipboard

Active modal contexts keyed by the modal entry's full path.

Link copied to clipboard

Live gesture scrub progress mirrored into state so followers and session captures can replicate interactive gestures. Cleared by any other navigation action.

Link copied to clipboard

Ordered back stack; the last element is always equal to currentEntry.

Link copied to clipboard

Breadcrumb trail derived from currentFullPath, suitable for navigation UIs.

Link copied to clipboard

true when there is more than one entry in backStack and a back navigation is possible.

Link copied to clipboard
Link copied to clipboard

The entry that is currently active (top of stack).

Link copied to clipboard

The full slash-separated path for currentEntry, e.g. "auth/login".

Link copied to clipboard

Ordered list of graph IDs from root to the graph containing currentEntry.

Link copied to clipboard

Path segments of currentFullPath with empty segments filtered out.

Link copied to clipboard

Values computed from backStack and activeModalContexts by the reducer.

Link copied to clipboard
Link copied to clipboard

Layer entries grouped by their RenderLayer.

Link copied to clipboard
Link copied to clipboard

true when at least one modal is present anywhere in backStack.

Link copied to clipboard

true until bootstrap (and any cold-start deep link) has fully resolved. NavigationRender suppresses content layers while this is true to avoid flashing the initial placeholder before the real destination is known.

Link copied to clipboard

true when currentEntry resolves to a Modal.

Link copied to clipboard

true when currentEntry resolves to a Screen.

Link copied to clipboard

true while a guard or entry-definition lambda is being evaluated and the evaluation has exceeded its loading threshold. NavigationRender renders the io.github.syrou.reaktiv.navigation.definition.LoadingModal directly as a boolean-controlled overlay rather than a backstack entry while this is true.

Link copied to clipboard

The most recent action dispatched by the navigation system, used for content preservation.

Link copied to clipboard

All modal entries currently present in backStack.

Link copied to clipboard

Number of segments in currentFullPath.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Navigation that was stored when a guard returned GuardResult.PendAndRedirectTo. Resume it after the guard condition is met via navigation { clearBackStack(); resumePendingNavigation() }.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

How long rendered screen content is retained in memory after being popped from the stack.

Link copied to clipboard

true when the current destination wants a navigation header.

Link copied to clipboard
Link copied to clipboard

Entries assigned to RenderLayer.SYSTEM (e.g. loading modals).

Link copied to clipboard
Link copied to clipboard

The screen rendered underneath the current modal, or null if not in a modal.

Link copied to clipboard

Graph hierarchy of underlyingScreen, used so that isInGraph works correctly when isCurrentModal is true.

Link copied to clipboard

Entries that should be rendered, ordered from bottom to top layer.

Link copied to clipboard

Functions

Link copied to clipboard
fun isAtPath(path: String): Boolean

Returns true if any visible layer's route or path matches path.

Link copied to clipboard
fun isInGraph(graphId: String): Boolean

Returns true if the current navigation position is inside the given graphId.