From 6749f88650646a7cf26c5f4ca2e789005330760d Mon Sep 17 00:00:00 2001 From: Eric Vicenti Date: Mon, 27 Apr 2015 17:23:19 -0700 Subject: [PATCH] [ReactNative] Fix Navigator resetTo --- Libraries/CustomComponents/Navigator/Navigator.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Libraries/CustomComponents/Navigator/Navigator.js b/Libraries/CustomComponents/Navigator/Navigator.js index da4d2ab10..152890dd1 100644 --- a/Libraries/CustomComponents/Navigator/Navigator.js +++ b/Libraries/CustomComponents/Navigator/Navigator.js @@ -957,7 +957,7 @@ var Navigator = React.createClass({ * `index` specifies the route in the stack that should be replaced. * If it's negative, it counts from the back. */ - replaceAtIndex: function(route, index) { + replaceAtIndex: function(route, index, cb) { invariant(!!route, 'Must supply route to replace'); if (index < 0) { index += this.state.routeStack.length; @@ -988,6 +988,7 @@ var Navigator = React.createClass({ this._emitWillFocus(route); this._emitDidFocus(route); } + cb && cb(); }); }, @@ -1034,8 +1035,9 @@ var Navigator = React.createClass({ resetTo: function(route) { invariant(!!route, 'Must supply route to push'); if (this._canNavigate()) { - this.replaceAtIndex(route, 0); - this.popToRoute(route); + this.replaceAtIndex(route, 0, () => { + this.popToRoute(route); + }); } },