Composable Function

NavigationBackHandler

A composable that handles back navigation gestures for a SceneState, driven by a NavigationEventState.

Source set: Common
@Composable
public fun <T : Any> NavigationBackHandler(
    sceneState: SceneState<T>,
    state: NavigationEventState<SceneInfo<T>> = rememberNavigationEventState(sceneState),
    onBackCancelled: () -> Unit = {},
    onBackCompleted: () -> Unit,
)

A composable that handles back navigation gestures for a SceneState, driven by a NavigationEventState.

This is a convenience wrapper around the core androidx.navigationevent.compose.NavigationBackHandler that automatically handles the NavigationEventState based on the provided sceneState.

Parameters

sceneState the SceneState that this handler is associated with.
state the hoisted NavigationEventState (returned from rememberNavigationEventState) to be registered.
onBackCancelled called if a back navigation gesture is cancelled.
onBackCompleted called when a back navigation gesture completes and navigation occurs.

Last updated: