Export GestureContexts and add missing type for withOrientation, fix header back button title prop type

This commit is contained in:
Brent Vatne
2019-03-19 13:58:18 -07:00
parent 368b6812bf
commit 4c29c57fe2
2 changed files with 26 additions and 1 deletions

View File

@@ -121,6 +121,15 @@ module.exports = {
return require('react-navigation-drawer').createDrawerNavigator;
},
// Gesture contexts
get StackGestureContext() {
return require('react-navigation-stack').StackGestureContext;
},
get DrawerGestureContext() {
return require('react-navigation-drawer').DrawerGestureContext;
},
// Routers and Actions
get DrawerRouter() {

View File

@@ -33,6 +33,8 @@
declare module 'react-navigation' {
import * as React from 'react';
import { PanGestureHandler } from 'react-native-gesture-handler';
import {
Animated,
TextStyle,
@@ -1331,7 +1333,7 @@ declare module 'react-navigation' {
export interface HeaderBackButtonProps {
onPress?: () => void;
pressColorAndroid?: string;
title?: string;
title?: string | null;
titleStyle?: StyleProp<TextStyle>;
tintColor?: string;
truncatedTitle?: string;
@@ -1352,6 +1354,18 @@ declare module 'react-navigation' {
T extends React.ComponentType<any>
> = T extends React.ComponentType<infer P> ? P : never;
export interface NavigationOrientationInjectedProps {
isLandscape: boolean;
}
export function withOrientation<P extends NavigationOrientationInjectedProps>(
Component: React.ComponentType<P>
): React.ComponentType<Omit<P, keyof NavigationOrientationInjectedProps>>;
export interface NavigationInjectedProps<P = NavigationParams> {
navigation: NavigationScreenProp<NavigationRoute<P>, P>;
}
export interface NavigationInjectedProps<P = NavigationParams> {
navigation: NavigationScreenProp<NavigationRoute<P>, P>;
}
@@ -1428,4 +1442,6 @@ declare module 'react-navigation' {
export const SafeAreaView: React.ComponentClass<SafeAreaViewProps>;
export const NavigationContext: React.Context<NavigationScreenProp<NavigationRoute>>;
export const StackGestureContext: React.Context<React.Ref<PanGestureHandler>>;
export const DrawerGestureContext: React.Context<React.Ref<PanGestureHandler>>;
}