Skip to content

Commit 708530a

Browse files
Hedger WangFacebook Github Bot 4
authored andcommitted
Handle old navigation state safely.
Reviewed By: mkonicek Differential Revision: D3359593 fbshipit-source-id: ca6dbcf14a31491bc6a3730243f358f21971e9f3
1 parent 3ba232f commit 708530a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Examples/UIExplorer/UIExplorerApp.ios.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ type State = UIExplorerNavigationState & {
6060
externalExample?: string,
6161
};
6262

63+
const APP_STATE_KEY = 'UIExplorerAppState.v1';
64+
6365
class UIExplorerApp extends React.Component {
6466
_renderOverlay: Function;
6567
_renderScene: Function;
@@ -81,7 +83,7 @@ class UIExplorerApp extends React.Component {
8183

8284
componentDidMount() {
8385
Linking.getInitialURL().then((url) => {
84-
AsyncStorage.getItem('UIExplorerAppState', (err, storedString) => {
86+
AsyncStorage.getItem(APP_STATE_KEY, (err, storedString) => {
8587
const exampleAction = URIActionMap(this.props.exampleFromAppetizeParams);
8688
const urlAction = URIActionMap(url);
8789
const launchAction = exampleAction || urlAction;
@@ -111,7 +113,7 @@ class UIExplorerApp extends React.Component {
111113
const newState = UIExplorerNavigationReducer(this.state, action);
112114
if (this.state !== newState) {
113115
this.setState(newState);
114-
AsyncStorage.setItem('UIExplorerAppState', JSON.stringify(this.state));
116+
AsyncStorage.setItem(APP_STATE_KEY, JSON.stringify(this.state));
115117
}
116118
}
117119

0 commit comments

Comments
 (0)