check if this._navBar has immediatelyRefresh method

Summary:
`Navigator` throws an error if using a custom `NavigationBar` component that does not have a `immediatelyRefresh` method present.
Closes https://github.com/facebook/react-native/pull/9438

Differential Revision: D3838928

Pulled By: mkonicek

fbshipit-source-id: 74d62ef09e179f457a4b14f8537dfaf0d4697322
This commit is contained in:
Andrew Grewell 2016-09-08 17:24:12 -07:00 committed by Facebook Github Bot
parent 6b42d5c952
commit 7b18b2c409
1 changed files with 4 additions and 1 deletions

View File

@ -495,7 +495,10 @@ var Navigator = React.createClass({
transitionQueue: [],
}, () => {
this._handleSpringUpdate();
this._navBar && this._navBar.immediatelyRefresh();
var navBar = this._navBar;
if (navBar && navBar.immediatelyRefresh) {
navBar.immediatelyRefresh();
}
this._emitDidFocus(this.state.routeStack[this.state.presentedIndex]);
});
},