mirror of
https://github.com/status-im/react-native.git
synced 2025-02-26 08:05:34 +00:00
[ReactNative] Fix Navigator resetTo
This commit is contained in:
parent
b6e6dae6ba
commit
6749f88650
@ -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);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user