From bb7f9c8b2ee7133a7f9cc3964ea34784e623b0f5 Mon Sep 17 00:00:00 2001 From: cailenmusselman Date: Tue, 20 Sep 2016 16:21:55 -0600 Subject: [PATCH 1/2] 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; /** From 7b6177781a82693479bc5414994126a32f5cb2c9 Mon Sep 17 00:00:00 2001 From: cailenmusselman Date: Wed, 21 Sep 2016 11:55:56 -0600 Subject: [PATCH 2/2] Update react-native.d.ts --- react-native/react-native.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/react-native/react-native.d.ts b/react-native/react-native.d.ts index 03135618a9..f99835c8a0 100644 --- a/react-native/react-native.d.ts +++ b/react-native/react-native.d.ts @@ -3252,9 +3252,9 @@ declare namespace __React { * Class that contains the info and methods for app navigation. */ export interface NavigationContext { - parent: NavigationContext, - top: NavigationContext, - currentRoute: any, + 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; @@ -3273,7 +3273,7 @@ declare namespace __React { export interface NavigatorStatic extends React.ComponentClass { SceneConfigs: SceneConfigs; NavigationBar: NavigatorStatic.NavigationBarStatic; - BreadcrumbNavigationBar: NavigatorStatic.BreadcrumbNavigationBarStatic + BreadcrumbNavigationBar: NavigatorStatic.BreadcrumbNavigationBarStatic; navigationContext: NavigationContext;