mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-23 20:01:01 +08:00
Backed out changeset ed509fc86e9d
Reviewed By: javache Differential Revision: D3029704 fb-gh-sync-id: 87e6fe282c08d7128e1f5f00a956af0b6e341b30 shipit-source-id: 87e6fe282c08d7128e1f5f00a956af0b6e341b30
This commit is contained in:
committed by
Facebook Github Bot 9
parent
3418dd5621
commit
9213d0411d
@@ -46,19 +46,6 @@ let _nextRouteNodeID = 0;
|
||||
class RouteNode {
|
||||
key: string;
|
||||
route: any;
|
||||
|
||||
/**
|
||||
* Cast `navigationState` as `RouteNode`.
|
||||
* Also see `RouteNode#toNavigationState`.
|
||||
*/
|
||||
static fromNavigationState(navigationState: NavigationState): RouteNode {
|
||||
invariant(
|
||||
navigationState instanceof RouteNode,
|
||||
'navigationState should be an instacne of RouteNode'
|
||||
);
|
||||
return navigationState;
|
||||
}
|
||||
|
||||
constructor(route: any) {
|
||||
// Key value gets bigger incrementally. Developer can compare the
|
||||
// keys of two routes then know which route is added to the stack
|
||||
@@ -97,15 +84,11 @@ let _nextRouteStackID = 0;
|
||||
* of the routes. This data structure is implemented as immutable data
|
||||
* and mutation (e.g. push, pop...etc) will yields a new instance.
|
||||
*/
|
||||
class RouteStack {
|
||||
class RouteStack {
|
||||
_index: number;
|
||||
_key: string;
|
||||
_routeNodes: Array<RouteNode>;
|
||||
|
||||
static getRouteByNavigationState(navigationState: NavigationState): any {
|
||||
return RouteNode.fromNavigationState(navigationState).route;
|
||||
}
|
||||
|
||||
constructor(index: number, routes: Array<any>) {
|
||||
invariant(
|
||||
routes.length > 0,
|
||||
|
||||
Reference in New Issue
Block a user