Skip to content

Commit

Permalink
Fix UIExplorer for android getting in a broken state
Browse files Browse the repository at this point in the history
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 9f10b85
Showing 1 changed file with 25 additions and 23 deletions.
48 changes: 25 additions & 23 deletions Examples/UIExplorer/js/UIExplorerApp.android.js
Expand Up @@ -151,29 +151,31 @@ class UIExplorerApp extends React.Component {
if (stack && stack.routes[index]) { if (stack && stack.routes[index]) {
const {key} = stack.routes[index]; const {key} = stack.routes[index];
const ExampleModule = UIExplorerList.Modules[key]; const ExampleModule = UIExplorerList.Modules[key];
return ( if (ExampleModule) {
<View style={styles.container}> return (
<ToolbarAndroid <View style={styles.container}>
logo={nativeImageSource({ <ToolbarAndroid
android: 'launcher_icon', logo={nativeImageSource({
width: 132, android: 'launcher_icon',
height: 144 width: 132,
})} height: 144
navIcon={nativeImageSource({ })}
android: 'ic_menu_black_24dp', navIcon={nativeImageSource({
width: 48, android: 'ic_menu_black_24dp',
height: 48 width: 48,
})} height: 48
onIconClicked={() => this.drawer.openDrawer()} })}
style={styles.toolbar} onIconClicked={() => this.drawer.openDrawer()}
title={title} style={styles.toolbar}
/> title={title}
<UIExplorerExampleContainer />
module={ExampleModule} <UIExplorerExampleContainer
ref={(example) => { this._exampleRef = example; }} module={ExampleModule}
/> ref={(example) => { this._exampleRef = example; }}
</View> />
); </View>
);
}
} }
return ( return (
<View style={styles.container}> <View style={styles.container}>
Expand Down

0 comments on commit 9f10b85

Please sign in to comment.