Skip to content

Commit

Permalink
UIExplorer fixes
Browse files Browse the repository at this point in the history
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
  • Loading branch information
andreicoman11 authored and Facebook Github Bot 6 committed Sep 6, 2016
1 parent d31756b commit 128b698
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Examples/UIExplorer/js/UIExplorerApp.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ type Props = {
exampleFromAppetizeParams: string,
};

type State = {
initialExampleUri: ?string,
type State = UIExplorerNavigationState & {
externalExample: ?string,
};

class UIExplorerApp extends React.Component {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 128b698

Please sign in to comment.