Skip to main content
‹ Lifecycle and events
Types

Types

The types of lifecycle and events.

SectionLifecycle and eventsDraftDocumented, not reviewed yet: the API can change.
Interface

The events of the navigation by name, with what each one gets; the events of a screen carry it as screen.

interface NavigationEvents
MemberTypeDescription
screenWillAppearRequiredScreenEventOf<ComponentWillAppearEvent>

A screen is about to appear; the components of the bars (title, buttons, background) are not screens.

screenDidAppearRequiredScreenEventOf<ComponentDidAppearEvent>

A screen appeared.

screenDidDisappearRequiredScreenEventOf<ComponentDidDisappearEvent>

A screen disappeared: something covers it, or it left.

screenPoppedRequiredScreenEventOf<NativeScreenPoppedEvent>

A screen left its stack by back, a swipe or pop.

buttonPressedRequiredScreenEventOf<NavigationButtonPressedEvent>
tabSelectedRequiredBottomTabSelectedEvent
tabPressedRequiredBottomTabPressedEvent
tabLongPressedRequiredBottomTabLongPressedEvent
modalDismissedRequiredScreenEventOf<NativeModalDismissedEvent>
modalDismissAttemptedRequiredScreenEventOf<ModalAttemptedToDismissEvent>

A swipe tried to dismiss a modal whose screen keeps the user (usePreventLeave).

searchChangedRequiredScreenEventOf<SearchBarUpdatedEvent>
searchSubmittedRequiredScreenEventOf<SearchBarSubmittedEvent>
searchCancelledRequiredScreenEventOf<SearchBarCancelPressedEvent>
searchSuggestionPickedRequiredScreenEventOf<NativeSearchSuggestionPickedEvent>

The user picked a suggestion of searchBar.suggestions; the text stays.

sheetDetentChangedRequiredScreenEventOf<NativeSheetDetentChangedEvent>

The user dragged a sheet to another detent.

splitViewDisplayModeChangedRequiredNativeSplitViewDisplayModeChangedEvent
iOSiPadOSAndroid (not supported)
keyCommandPressedRequiredScreenEventOf<NativeKeyCommandPressedEvent>
titleRenamedRequiredScreenEventOf<NativeTitleRenamedEvent>
iOSiPadOSAndroid (not supported)
accessoryPlacementChangedRequiredBottomAccessoryPlacementChangedEvent
iOS 26+iPadOS 26+Android (not supported)
previewCompletedRequiredScreenEventOf<NativePreviewCompletedEvent>
iOSiPadOSAndroid (not supported)
stateChangedRequiredNavigationState

What the user sees changed: the screen or the selected tab.

Defined in src/api/events/navigationEvents.ts ↗
Type
type NavigationEventName = keyof NavigationEvents
Defined in src/api/events/navigationEvents.ts ↗
Type

Handlers of the events of the navigation, by event name.

type NavigationListeners = {
[Name in NavigationEventName]?: (event: NavigationEvents[Name]) => void;
}
Defined in src/api/events/navigationEvents.ts ↗

ScreenEventName​

Type

The events a screen hears about itself: those that carry the screen, and the move of the accessory it shows.

type ScreenEventName =
| {
[Name in NavigationEventName]: NavigationEvents[Name] extends { screen: unknown }
? Name
: never;
}[NavigationEventName]
| 'accessoryPlacementChanged'
Defined in src/api/hooks/screenHooks.ts ↗
Type

What the user sees: the screen and the selected tab. The native side sends it when it changes, and before a command that changed it resolves.

type NavigationState = NavigationStateChangedEvent
MemberTypeDescription
screenRequired{ id: string; name: string } | null

The visible screen with its name in screens, or null when there is none. In a container the visible screen is the one it shows.

tabRequirednumber | null

The index of the selected tab of the nearest tabs around the visible screen, or null outside tabs.

Defined in src/api/state/navigationState.ts ↗

ScreenWillAppearEvent​

Type
type ScreenWillAppearEvent = NavigationEvents['screenWillAppear']
MemberTypeDescription
screenRequiredScreenRef
Defined in src/api/events/navigationEvents.ts ↗

ScreenDidAppearEvent​

Type
type ScreenDidAppearEvent = NavigationEvents['screenDidAppear']
MemberTypeDescription
screenRequiredScreenRef
Defined in src/api/events/navigationEvents.ts ↗

ScreenDidDisappearEvent​

Type
type ScreenDidDisappearEvent = NavigationEvents['screenDidDisappear']
MemberTypeDescription
screenRequiredScreenRef
Defined in src/api/events/navigationEvents.ts ↗