react-native-navigation的迁移库

Navigation.md 3.9KB

Navigation


navigation.registerComponent(componentName, getComponentFunc)

Every screen component in your app must be registered with a unique name. The component itself is a traditional React component extending React.Component.

Param Type Description
componentName string Unique component name
getComponentFunc function generator function, typically () => require('./myComponent')

navigation.setRoot(root)

Reset the navigation stack to a new screen (the stack root is changed).

Param Type
root Root

navigation.setDefaultOptions(options)

Set default options to all screens. Useful for declaring a consistent style across the app.

Param Type
options NavigationOptions

navigation.setOptions(componentId, options)

Change a components navigation options

Param Type Description
componentId string The component’s id.
options NavigationOptions

navigation.showModal(params)

Show a screen as a modal.

Param Type
params object

navigation.dismissModal(componentId)

Dismiss a modal by componentId. The dismissed modal can be anywhere in the stack.

Param Type Description
componentId string The component’s id.

navigation.dismissAllModals()

Dismiss all Modals


navigation.push(componentId, component)

Push a new screen into this screen’s navigation stack.

Param Type Description
componentId string The component’s id.
component Component

navigation.pop(componentId, params)

Pop a component from the stack, regardless of it’s position.

Param Type Description
componentId string The component’s id.
params *

navigation.popTo(componentId)

Pop the stack to a given component

Param Type Description
componentId string The component’s id.

navigation.popToRoot(componentId)

Pop the component’s stack to root.

Param Type
componentId *

navigation.events()

Obtain the events registery instance