fix: change type of the navigation field in DrawerContentComponentProps (#121)

This commit is contained in:
Bryan Kok
2019-10-29 00:46:46 +08:00
parent 2bc25b6771
commit f92d3ed4a8
3 changed files with 5 additions and 7 deletions

View File

@@ -3,7 +3,6 @@ import {
NavigationState,
NavigationRoute,
NavigationParams,
NavigationProp,
NavigationDescriptor,
SupportedThemes,
NavigationScreenConfig,
@@ -109,7 +108,7 @@ export type DrawerNavigatorItemsProps = {
};
export type DrawerContentComponentProps = DrawerNavigatorItemsProps & {
navigation: NavigationProp<NavigationDrawerState>;
navigation: NavigationScreenProp<NavigationDrawerState>;
descriptors: SceneDescriptorMap;
drawerOpenProgress: Animated.Node<number>;
screenProps: unknown;

View File

@@ -3,7 +3,7 @@ import { StyleSheet, View, ViewStyle } from 'react-native';
import {
NavigationActions,
NavigationRoute,
NavigationProp,
NavigationScreenProp,
} from 'react-navigation';
import Animated from 'react-native-reanimated';
import {
@@ -17,7 +17,7 @@ type Props = {
contentComponent?: React.ComponentType<DrawerContentComponentProps>;
contentOptions?: object;
screenProps?: unknown;
navigation: NavigationProp<NavigationDrawerState>;
navigation: NavigationScreenProp<NavigationDrawerState>;
descriptors: SceneDescriptorMap;
drawerOpenProgress: Animated.Node<number>;
drawerPosition: 'left' | 'right';
@@ -73,7 +73,6 @@ class DrawerSidebar extends React.PureComponent<Props> {
focused: boolean;
}) => {
if (focused) {
// @ts-ignore
this.props.navigation.closeDrawer();
} else {
this.props.navigation.dispatch(

View File

@@ -4,7 +4,7 @@ import {
SceneView,
ThemeColors,
ThemeContext,
NavigationProp,
NavigationScreenProp,
} from 'react-navigation';
import { ScreenContainer } from 'react-native-screens';
@@ -41,7 +41,7 @@ type DrawerOptions = {
type Props = {
lazy: boolean;
navigation: NavigationProp<NavigationDrawerState>;
navigation: NavigationScreenProp<NavigationDrawerState>;
descriptors: SceneDescriptorMap;
navigationConfig: DrawerOptions & {
contentComponent?: React.ComponentType<DrawerContentComponentProps>;