mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-04-29 04:45:19 +08:00
State persistence (#3716)
Adds a new state persistence mechanisms to all of the navigators via createNavigationContainer
There are two new props that you can provide to a navigation container: `storageKey` and `renderLoading`.
`storageKey` is the string key to be used with AsyncStorage while saving and persisting navigation state. To disable persistence, set to null.
`renderLoading` allows you to render something while the navigator re-hydrates its state and loads its initial URL. By default this returns null, but Expo users will want to render a <AppLoading /> component for smooth app launches
There is also functionality in this PR to observe errors that come from re-hydrating state, and gracefully recover by dispatching an init action.
Also this revises the init action to *reset* the navigation state, rather than preserve the previous state.
This commit is contained in:
committed by
Brent Vatne
parent
5e4512f3eb
commit
9cf557bba0
2
flow/react-navigation.js
vendored
2
flow/react-navigation.js
vendored
@@ -538,6 +538,8 @@ declare module 'react-navigation' {
|
||||
NavigationAction
|
||||
) => void,
|
||||
navigation?: NavigationScreenProp<S>,
|
||||
persistenceKey?: ?string,
|
||||
renderLoadingExperimental?: React$ComponentType<{}>,
|
||||
screenProps?: *,
|
||||
navigationOptions?: O,
|
||||
}>;
|
||||
|
||||
Reference in New Issue
Block a user