[ReactNative] Navigator focus handler context fix

This commit is contained in:
Eric Vicenti 2015-05-01 17:50:20 -07:00
parent 43e038887d
commit 28e6e993c6
1 changed files with 6 additions and 7 deletions

View File

@ -231,16 +231,13 @@ var Navigator = React.createClass({
initialRouteStack: PropTypes.arrayOf(PropTypes.object),
/**
* Will emit the target route upon mounting and before each nav transition,
* overriding the handler in this.props.navigator. This overrides the onDidFocus
* handler that would be found in this.props.navigator
* Will emit the target route upon mounting and before each nav transition
*/
onWillFocus: PropTypes.func,
/**
* Will be called with the new route of each scene after the transition is
* complete or after the initial mounting. This overrides the onDidFocus
* handler that would be found in this.props.navigator
* complete or after the initial mounting
*/
onDidFocus: PropTypes.func,
@ -601,7 +598,8 @@ var Navigator = React.createClass({
this._lastDidFocus = route;
if (this.props.onDidFocus) {
this.props.onDidFocus(route);
} else if (this.parentNavigator && this.parentNavigator.onDidFocus) {
}
if (this.parentNavigator && this.parentNavigator.onDidFocus) {
this.parentNavigator.onDidFocus(route);
}
},
@ -617,7 +615,8 @@ var Navigator = React.createClass({
}
if (this.props.onWillFocus) {
this.props.onWillFocus(route);
} else if (this.parentNavigator && this.parentNavigator.onWillFocus) {
}
if (this.parentNavigator && this.parentNavigator.onWillFocus) {
this.parentNavigator.onWillFocus(route);
}
},