From bb7f9c8b2ee7133a7f9cc3964ea34784e623b0f5 Mon Sep 17 00:00:00 2001 From: cailenmusselman Date: Tue, 20 Sep 2016 16:21:55 -0600 Subject: [PATCH] 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 { ... } --- react-native/react-native.d.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/react-native/react-native.d.ts b/react-native/react-native.d.ts index 732e4aacde..03135618a9 100644 --- a/react-native/react-native.d.ts +++ b/react-native/react-native.d.ts @@ -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; /**