Add navigationContext to react-native Navigator

react-native\Libraries\CustomComponents\Navigator\Navigator.js

var Navigator = React.createClass({
  ...
  componentWillMount: function() {
    // TODO(t7489503): Don't need this once ES6 Class landed.
    this.__defineGetter__('navigationContext', this._getNavigationContext);

    this._subRouteFocus = [];
    ...
    ... 
}

react-native\Libraries\CustomComponents\Navigator\Navigation\NavigationContext.js

class NavigationContext {
   ...
}
This commit is contained in:
cailenmusselman
2016-09-20 16:21:55 -06:00
committed by GitHub
parent fbe2a7d056
commit bb7f9c8b2e
+15
View File
@@ -3247,6 +3247,19 @@ declare namespace __React {
debugOverlay?: boolean
}
/**
* Class that contains the info and methods for app navigation.
*/
export interface NavigationContext {
parent: NavigationContext,
top: NavigationContext,
currentRoute: any,
appendChild(childContext: NavigationContext): void;
addListener(eventType: string, listener: () => void, useCapture?: boolean): NativeEventSubscription;
emit(eventType: string, data: any, didEmitCallback?: () => void): void;
dispose(): void;
}
/**
* Use Navigator to transition between different scenes in your app.
@@ -3262,6 +3275,8 @@ declare namespace __React {
NavigationBar: NavigatorStatic.NavigationBarStatic;
BreadcrumbNavigationBar: NavigatorStatic.BreadcrumbNavigationBarStatic
navigationContext: NavigationContext;
getContext( self: any ): NavigatorStatic;
/**