mirror of
https://github.com/status-im/react-native.git
synced 2025-01-14 19:44:13 +00:00
UIExplorer fixes
Summary: Currently, when reloading uiexplorer, it does not go back to the last visited component. This fixes it, by only storing the state (which contains the last visited component), after it has been set. Reviewed By: bestander Differential Revision: D3821288 fbshipit-source-id: 5b9ba10765ce402c20016519a3b7f6b5211cc623
This commit is contained in:
parent
d31756bf01
commit
128b698a03
@ -50,8 +50,8 @@ type Props = {
|
||||
exampleFromAppetizeParams: string,
|
||||
};
|
||||
|
||||
type State = {
|
||||
initialExampleUri: ?string,
|
||||
type State = UIExplorerNavigationState & {
|
||||
externalExample: ?string,
|
||||
};
|
||||
|
||||
class UIExplorerApp extends React.Component {
|
||||
@ -185,8 +185,10 @@ class UIExplorerApp extends React.Component {
|
||||
this.drawer && this.drawer.closeDrawer();
|
||||
const newState = UIExplorerNavigationReducer(this.state, action);
|
||||
if (this.state !== newState) {
|
||||
this.setState(newState);
|
||||
AsyncStorage.setItem('UIExplorerAppState', JSON.stringify(this.state));
|
||||
this.setState(
|
||||
newState,
|
||||
() => AsyncStorage.setItem('UIExplorerAppState', JSON.stringify(this.state))
|
||||
);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user