From 2cc88d04eecc2dd35f7b6d16d12cf1a8ebee36f4 Mon Sep 17 00:00:00 2001 From: Aaron Rosen Date: Fri, 15 Feb 2019 14:50:46 -0500 Subject: [PATCH] ReactNavigation: Exposes NavigationContext type. --- types/react-navigation/index.d.ts | 5 ++++- types/react-navigation/react-navigation-tests.tsx | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index df678c4ed9..860d54523e 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -31,6 +31,7 @@ // Fellipe Chagas // Deniss Borisovs // Kenneth Skovhus +// Aaron Rosen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -623,7 +624,7 @@ export interface NavigationEventSubscription { } export interface NavigationEventsProps extends ViewProps { - navigation?: NavigationNavigator; + navigation?: NavigationScreenProp; onWillFocus?: NavigationEventCallback; onDidFocus?: NavigationEventCallback; onWillBlur?: NavigationEventCallback; @@ -1367,3 +1368,5 @@ export interface SafeAreaViewProps extends ViewProps { } export const SafeAreaView: React.ComponentClass; + +export const NavigationContext: React.Context>; diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index d30714fadb..777a8fa9f3 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -42,6 +42,7 @@ import { HeaderBackButton, Header, NavigationContainer, + NavigationContext, NavigationParams, NavigationPopAction, NavigationPopToTopAction, @@ -681,3 +682,14 @@ const ViewWithNavigationEvents = ( onDidBlur={console.log} /> ); + +// Test NavigationContext +const componentWithNavigationContext = ( + + { + navigationContext => ( + + ) + } + +);