Fix NavigatorIOS freeze when pushing before initialization completes
Summary: This freezes the app in the UIExplorer because we try to push a new view controller onto the screen before the navigator finishes loading. This was exacerbated by @tadeuzagallo's diff that made the loading even faster. Hehe
This commit is contained in:
parent
7232b1bbc7
commit
f552495e7f
|
@ -123,32 +123,6 @@ class UIExplorerList extends React.Component {
|
|||
);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
var wasUIExplorer = false;
|
||||
var didOpenExample = false;
|
||||
|
||||
this.props.navigator.navigationContext.addListener('didfocus', (event) => {
|
||||
var isUIExplorer = event.data.route.title === 'UIExplorer';
|
||||
|
||||
if (!didOpenExample && isUIExplorer) {
|
||||
didOpenExample = true;
|
||||
|
||||
var visibleExampleTitle = Settings.get('visibleExample');
|
||||
if (visibleExampleTitle) {
|
||||
var predicate = (example) => example.title === visibleExampleTitle;
|
||||
var foundExample = APIS.find(predicate) || COMPONENTS.find(predicate);
|
||||
if (foundExample) {
|
||||
setTimeout(() => this._openExample(foundExample), 100);
|
||||
}
|
||||
} else if (!wasUIExplorer && isUIExplorer) {
|
||||
Settings.set({visibleExample: null});
|
||||
}
|
||||
}
|
||||
|
||||
wasUIExplorer = isUIExplorer;
|
||||
});
|
||||
}
|
||||
|
||||
renderAdditionalView(renderRow: Function, renderTextInput: Function): React.Component {
|
||||
return renderTextInput(styles.searchTextInput);
|
||||
}
|
||||
|
@ -171,7 +145,6 @@ class UIExplorerList extends React.Component {
|
|||
}
|
||||
|
||||
onPressRow(example: any) {
|
||||
Settings.set({visibleExample: example.title});
|
||||
this._openExample(example);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue