Skip to main content
Version: 7.37.0

Stack

push()#

Push a screen into the stack and update the display according to the screen options.

Parameters#

NameRequiredTypeDescription
componentIdYesstringThe componentId of a screen pushed into the stack, or the id of the stack.
layoutNoLayoutThe layout being pushed into the stack. Any type of layout (except stack) can be pushed into stacks. Typically, Component layout is pushed into stacks but it's possible to push SideMenu or BottomTabs as well.

Example#

The most common use case - push a single React component.
Navigation.push(this.props.componentId, {
component: {
name: 'example.PushedScreen'
}
});

pop()#

Pop the top screen from the stack.

Parameters#

NameRequiredTypeDescription
componentIdYesstringThe componentId of a screen pushed into the stack, or the stack id.
mergeOptionsNoOptionsOptions to be merged before popping the screen (optional).
Navigation.pop(this.props.componentId);

popToRoot()#

Pop all screens pushed into the stack.

Parameters#

NameRequiredTypeDescription
componentIdYesstringThe componentId of a screen pushed into the stack, or the stack id.
mergeOptionsNoOptionsOptions to be merged before popping the screen (optional).
Navigation.popToRoot(this.props.componentId);

popTo()#

Pop the stack to a given component.

Parameters#

NameRequiredTypeDescription
componentIdYesstringThe destination componentId
mergeOptionsNoOptionsOptions to be merged before popping the screen (optional).
Navigation.popTo(componentId);

setStackRoot()#

Reset the stack to the given layout (accepts multiple children).

Parameters#

NameRequiredTypeDescription
componentIdYesstringThe componentId of a screen pushed into the stack, or the stack id.
layoutYesLayout or Layout[]A single Component or array of components.

Example#

Navigation.setStackRoot(this.props.componentId, {
component: {
name: 'example.NewRootScreen'
}
});