Permalink
Browse files

Fix UIExplorer for android getting in a broken state

Summary:
If you have a new example that you add to the UIExplorer, enter the example, but
then change the name of the example or remove it, the explorer enters a
completely broken state. It remembers the name of the last module entered and
keeps trying to enter it. Reloading, refreshing, nothing will work until you
completely reinstall the app.
This fixes this by not trying to render the current module if it doesn't exist.
It will simply skip it.

Reviewed By: yungsters

Differential Revision: D4475088

fbshipit-source-id: d4a530b235aa2712d663377e33fe65091163d262
  • Loading branch information...
andreicoman11 authored and facebook-github-bot committed Jan 29, 2017
1 parent c681959 commit 9f10b85e10cdd70baac9df9f2b49e8b0e63d0f00
Showing with 25 additions and 23 deletions.
  1. +25 −23 Examples/UIExplorer/js/UIExplorerApp.android.js
@@ -151,29 +151,31 @@ class UIExplorerApp extends React.Component {
if (stack && stack.routes[index]) {
const {key} = stack.routes[index];
const ExampleModule = UIExplorerList.Modules[key];
return (
<View style={styles.container}>
<ToolbarAndroid
logo={nativeImageSource({
android: 'launcher_icon',
width: 132,
height: 144
})}
navIcon={nativeImageSource({
android: 'ic_menu_black_24dp',
width: 48,
height: 48
})}
onIconClicked={() => this.drawer.openDrawer()}
style={styles.toolbar}
title={title}
/>
<UIExplorerExampleContainer
module={ExampleModule}
ref={(example) => { this._exampleRef = example; }}
/>
</View>
);
if (ExampleModule) {
return (
<View style={styles.container}>
<ToolbarAndroid
logo={nativeImageSource({
android: 'launcher_icon',
width: 132,
height: 144
})}
navIcon={nativeImageSource({
android: 'ic_menu_black_24dp',
width: 48,
height: 48
})}
onIconClicked={() => this.drawer.openDrawer()}
style={styles.toolbar}
title={title}
/>
<UIExplorerExampleContainer
module={ExampleModule}
ref={(example) => { this._exampleRef = example; }}
/>
</View>
);
}
}
return (
<View style={styles.container}>

0 comments on commit 9f10b85

Please sign in to comment.