mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
[Navigation]: Add a method to map the stack routes to an array.
Summary: Add a method to map the stack routes to an array.
This commit is contained in:
@@ -202,11 +202,19 @@ class RouteStack {
|
||||
var nodes = this._routeNodes;
|
||||
while (ii < nodes.size) {
|
||||
var node = nodes.get(ii);
|
||||
callback(node.value, ii, node.key);
|
||||
callback.call(context, node.value, ii, node.key);
|
||||
ii++;
|
||||
}
|
||||
}
|
||||
|
||||
mapToArray(callback: IterationCallback, context: ?Object): Array<any> {
|
||||
var result = [];
|
||||
this.forEach((route, index, key) => {
|
||||
result.push(callback.call(context, route, index, key));
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a Set excluding any routes contained within the stack given.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user