Composable Function

rememberNavigationEventState

Remembers and returns a NavigationEventState instance for a SceneState.

rememberNavigationEventState

Source set: Common
@Composable
public fun <T : Any> rememberNavigationEventState(
    sceneState: SceneState<T>
): NavigationEventState<SceneInfo<T>>

Remembers and returns a NavigationEventState instance for a SceneState.

This composable creates and remembers a NavigationEventState object, which holds a NavigationEventHandler internally. This is the state object that can be passed to NavigationBackHandler (the composable) to "hoist" the state.

The state's handler info (currentInfo and backInfo) is kept in sync with the provided sceneState.

Parameters

T the type of the key in the SceneState.
sceneState the SceneState that this state will track.

Return

a stable, remembered NavigationEventState instance.

Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: