UNPKG

4.28 kBTypeScriptView Raw
1/// <reference types="react" />
2import { NavigationScreenProp, NavigationState, NavigationRoute, NavigationParams, NavigationDescriptor, SupportedThemes, NavigationScreenConfig } from 'react-navigation';
3import { StyleProp, ViewStyle, TextStyle } from 'react-native';
4import Animated from 'react-native-reanimated';
5export declare type Scene = {
6 route: NavigationRoute;
7 index: number;
8 focused: boolean;
9 tintColor?: string;
10};
11export declare type NavigationDrawerState = NavigationState & {
12 isDrawerOpen: boolean;
13};
14export declare type NavigationDrawerProp<State = NavigationRoute, Params = NavigationParams> = NavigationScreenProp<State, Params> & {
15 openDrawer: () => void;
16 closeDrawer: () => void;
17 toggleDrawer: () => void;
18 jumpTo: (routeName: string, key?: string) => void;
19};
20export declare type DrawerLockMode = 'unlocked' | 'locked-closed' | 'locked-open';
21export declare type DrawerIconProps = {
22 tintColor?: string;
23 focused: boolean;
24};
25export declare type DrawerLabelProps = {
26 tintColor?: string;
27 focused: boolean;
28};
29export declare type NavigationDrawerOptions = {
30 title?: string;
31 drawerLabel?: React.ReactNode | ((props: DrawerLabelProps) => React.ReactNode);
32 drawerIcon?: React.ReactNode | ((props: DrawerIconProps) => React.ReactNode);
33 drawerLockMode?: DrawerLockMode;
34};
35export declare type NavigationDrawerConfig = {
36 contentComponent?: React.ComponentType<DrawerContentComponentProps>;
37 edgeWidth?: number;
38 minSwipeDistance?: number;
39 drawerWidth?: number | (() => number);
40 drawerPosition?: 'left' | 'right';
41 drawerType?: 'front' | 'back' | 'slide';
42 drawerLockMode?: DrawerLockMode;
43 keyboardDismissMode?: 'none' | 'on-drag';
44 swipeEdgeWidth?: number;
45 swipeDistanceThreshold?: number;
46 swipeVelocityThreshold?: number;
47 hideStatusBar?: boolean;
48 statusBarAnimation?: 'slide' | 'none' | 'fade';
49 drawerBackgroundColor?: ThemedColor;
50 overlayColor?: ThemedColor;
51 screenContainerStyle?: StyleProp<ViewStyle>;
52 detachInactiveScreens?: boolean;
53};
54export declare type NavigationDrawerRouterConfig = {
55 unmountInactiveRoutes?: boolean;
56 resetOnBlur?: boolean;
57 initialRouteName?: string;
58 contentComponent?: React.ComponentType<DrawerContentComponentProps>;
59 contentOptions?: object;
60 backBehavior?: 'none' | 'initialRoute' | 'history';
61};
62export declare type ThemedColor = string | {
63 light: string;
64 dark: string;
65};
66export declare type DrawerNavigatorItemsProps = {
67 items: NavigationRoute[];
68 activeItemKey?: string | null;
69 activeTintColor?: string | ThemedColor;
70 activeBackgroundColor?: string | ThemedColor;
71 inactiveTintColor?: string | ThemedColor;
72 inactiveBackgroundColor?: string | ThemedColor;
73 getLabel: (scene: Scene) => React.ReactNode;
74 renderIcon: (scene: Scene) => React.ReactNode;
75 onItemPress: (scene: {
76 route: NavigationRoute;
77 focused: boolean;
78 }) => void;
79 itemsContainerStyle?: StyleProp<ViewStyle>;
80 itemStyle?: StyleProp<ViewStyle>;
81 labelStyle?: StyleProp<TextStyle>;
82 activeLabelStyle?: StyleProp<TextStyle>;
83 inactiveLabelStyle?: StyleProp<TextStyle>;
84 iconContainerStyle?: StyleProp<ViewStyle>;
85 drawerPosition: 'left' | 'right';
86 screenProps: unknown;
87};
88export declare type DrawerContentComponentProps = DrawerNavigatorItemsProps & {
89 navigation: NavigationScreenProp<NavigationDrawerState>;
90 descriptors: SceneDescriptorMap;
91 drawerOpenProgress: Animated.Node<number>;
92 screenProps: unknown;
93};
94export declare type NavigationDrawerScreenProps<Params = NavigationParams, ScreenProps = unknown> = {
95 theme: SupportedThemes;
96 navigation: NavigationDrawerProp<NavigationRoute, Params>;
97 screenProps: ScreenProps;
98};
99export declare type NavigationDrawerScreenComponent<Params = NavigationParams, ScreenProps = unknown> = React.ComponentType<NavigationDrawerScreenProps<Params, ScreenProps>> & {
100 navigationOptions?: NavigationScreenConfig<NavigationDrawerOptions, NavigationDrawerProp<NavigationRoute, Params>, ScreenProps>;
101};
102export declare type SceneDescriptorMap = {
103 [key: string]: NavigationDescriptor<NavigationParams, NavigationDrawerOptions, NavigationDrawerProp<NavigationRoute, any>>;
104};