Emit `willfocus` from immediatelyResetRouteStack

Summary:
The Navigator component inconsistently emits the `willfocus` event.

While it is emitted in `Navigator#resetTo`, `Navigator#push`, `Navigator#pop` and event `Navigator#replaceAtIndex` it is not emitted from `Navigator#immediatelyResetRouteStack`. This leads to surprising inconsistencies when working with these events.

With the PR I suggest to emit the `willfocus` event before resetting the route stack.
Closes https://github.com/facebook/react-native/pull/10125

Differential Revision: D3931284

fbshipit-source-id: 6e4f45c6d38426bcd0acc8f8c39478524032a03a
This commit is contained in:
Lord Daniel Zautner 2016-09-27 11:31:24 -07:00 committed by Facebook Github Bot 8
parent b32a857d60
commit 95b1fc42b7
1 changed files with 1 additions and 0 deletions

View File

@ -484,6 +484,7 @@ var Navigator = React.createClass({
*/
immediatelyResetRouteStack: function(nextRouteStack) {
var destIndex = nextRouteStack.length - 1;
this._emitWillFocus(nextRouteStack[destIndex]);
this.setState({
routeStack: nextRouteStack,
sceneConfigStack: nextRouteStack.map(