mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
ReactNavigation: Exposes NavigationContext type.
This commit is contained in:
5
types/react-navigation/index.d.ts
vendored
5
types/react-navigation/index.d.ts
vendored
@@ -31,6 +31,7 @@
|
||||
// Fellipe Chagas <https://github.com/chagasaway>
|
||||
// Deniss Borisovs <https://github.com/denissb>
|
||||
// Kenneth Skovhus <https://github.com/skovhus>
|
||||
// Aaron Rosen <https://github.com/azrosen92>
|
||||
// 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<NavigationRoute>;
|
||||
onWillFocus?: NavigationEventCallback;
|
||||
onDidFocus?: NavigationEventCallback;
|
||||
onWillBlur?: NavigationEventCallback;
|
||||
@@ -1367,3 +1368,5 @@ export interface SafeAreaViewProps extends ViewProps {
|
||||
}
|
||||
|
||||
export const SafeAreaView: React.ComponentClass<SafeAreaViewProps>;
|
||||
|
||||
export const NavigationContext: React.Context<NavigationScreenProp<NavigationRoute>>;
|
||||
|
||||
@@ -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.Consumer>
|
||||
{
|
||||
navigationContext => (
|
||||
<NavigationEvents navigation={navigationContext} />
|
||||
)
|
||||
}
|
||||
</NavigationContext.Consumer>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user