Events
#
onAppLaunchedCalled once the app is launched. Used to set the initial layout of the Application - after that the app is ready for user interaction.
RNN automatically unsubscribes components when they unmount, therefore unsubscribing isn't actually mandatory if you subscribed in componentDidMount
.
But you can use the following method to unsubscribe manually:
#
componentWillAppearCalled each time before this component appears on the screen (notifies that the component view is about to be added to the view hierarchy).
#
componentDidAppearCalled each time this component appears on the screen (attached to the view hierarchy).
This event can be observed globally as well:
Parameter | Description |
---|---|
componentId | Id of the appearing component |
componentName | Registered name used when registering the component with Navigation.registerComponent() |
passProps | props passed to the component |
#
componentDidDisappearCalled each time this component disappears from the screen (detached from the view hierarchy).
This event can be observed globally as well:
Parameter | Description |
---|---|
componentId | Id of the disappearing component |
componentName | Registered name used when registering the component with Navigation.registerComponent() |
#
registerCommandListenerThe commandListener
is called whenever a Navigation command (i.e push, pop, showModal etc) is invoked.
Parameter | Description |
---|---|
name | The name of the command that was invoked. For example push |
params | commandId : Each command is assigned a unique IdcomponentId : Optional, the componentId passed to the commandlayout : Optional, if the command invoked created a screen. Slim representation of the component and its options |
#
registerCommandCompletedListenerInvoked when a command finishes executing in native. If the command contains animations, for example pushed screen animation, the listener is invoked after the animation ends.
Parameter | Description |
---|---|
commandId | Id of the completed command |
completionTime | Timestamp when the command, and consecutive animations, completed. |
#
registerModalDismissedListenerInvoked when a modal is dismissed.
Parameter | Description |
---|---|
componentId | Id of the modal |
modalsDismissed | Number of modals that were dismissed |
#
registerModalAttemptedToDismissListener(iOS 13+ only)Invoked only on iOS pageSheet modal when swipeToDismiss
flag is set to true and modal was swiped down to dismiss.
Parameter | Description |
---|---|
componentId | Id of the modal a user is attempting to dismiss |
#
registerScreenPoppedListenerInvoked when the screen is popped.
Parameter | Description |
---|---|
componentId | Id of the screen which was popped |
#
registerBottomTabSelectedListenerInvoked when BottomTab is selected by a user.
#
registerBottomTabLongPressedListenerInvoked when BottomTab is long pressed by a user.
Parameter | Description |
---|---|
selectedTabIndex | Index of the newly selected tab |
unselectedTabIndex | Index of the previously selected tab |
#
navigationButtonPressed eventThis event is emitted whenever a TopBar button is pressed by a user.
This event can be observed globally as well:
Parameter | Description |
---|---|
buttonId | buttonId : id of the pressed button |
#
searchBarUpdated (iOS 11+ only)Called whenever the SearchBar of NavigationBar is updated.
#
searchBarCancelPressed (iOS 11+ only)Called when the cancel button of the SearchBar from NavigationBar is pressed.
#
previewCompleted (iOS 11.4+ only)Called when preview peek is completed.