This repository has been archived by the owner on Feb 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 125
/
Copy pathtypes.tsx
143 lines (128 loc) · 3.95 KB
/
types.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
import {
NavigationScreenProp,
NavigationState,
NavigationRoute,
NavigationParams,
NavigationDescriptor,
SupportedThemes,
NavigationScreenConfig,
} from 'react-navigation';
import { StyleProp, ViewStyle, TextStyle } from 'react-native';
import Animated from 'react-native-reanimated';
export type Scene = {
route: NavigationRoute;
index: number;
focused: boolean;
tintColor?: string;
};
export type NavigationDrawerState = NavigationState & {
isDrawerOpen: boolean;
};
export type NavigationDrawerProp<
State = NavigationRoute,
Params = NavigationParams
> = NavigationScreenProp<State, Params> & {
openDrawer: () => void;
closeDrawer: () => void;
toggleDrawer: () => void;
jumpTo: (routeName: string, key?: string) => void;
};
export type DrawerLockMode = 'unlocked' | 'locked-closed' | 'locked-open';
export type DrawerIconProps = {
tintColor?: string;
focused: boolean;
};
export type DrawerLabelProps = {
tintColor?: string;
focused: boolean;
};
export type NavigationDrawerOptions = {
title?: string;
drawerLabel?:
| React.ReactNode
| ((props: DrawerLabelProps) => React.ReactNode);
drawerIcon?: React.ReactNode | ((props: DrawerIconProps) => React.ReactNode);
drawerLockMode?: DrawerLockMode;
};
export type NavigationDrawerConfig = {
contentComponent?: React.ComponentType<DrawerContentComponentProps>;
edgeWidth?: number;
minSwipeDistance?: number;
drawerWidth?: number | (() => number);
drawerPosition?: 'left' | 'right';
drawerType?: 'front' | 'back' | 'slide';
drawerLockMode?: DrawerLockMode;
keyboardDismissMode?: 'none' | 'on-drag';
swipeEdgeWidth?: number;
swipeDistanceThreshold?: number;
swipeVelocityThreshold?: number;
hideStatusBar?: boolean;
statusBarAnimation?: 'slide' | 'none' | 'fade';
drawerBackgroundColor?: ThemedColor;
overlayColor?: ThemedColor;
screenContainerStyle?: StyleProp<ViewStyle>;
};
export type NavigationDrawerRouterConfig = {
unmountInactiveRoutes?: boolean;
resetOnBlur?: boolean;
initialRouteName?: string;
contentComponent?: React.ComponentType<DrawerContentComponentProps>;
contentOptions?: object;
backBehavior?: 'none' | 'initialRoute' | 'history';
};
export type ThemedColor =
| string
| {
light: string;
dark: string;
};
export type DrawerNavigatorItemsProps = {
items: NavigationRoute[];
activeItemKey?: string | null;
activeTintColor?: string | ThemedColor;
activeBackgroundColor?: string | ThemedColor;
inactiveTintColor?: string | ThemedColor;
inactiveBackgroundColor?: string | ThemedColor;
getLabel: (scene: Scene) => React.ReactNode;
renderIcon: (scene: Scene) => React.ReactNode;
onItemPress: (scene: { route: NavigationRoute; focused: boolean }) => void;
itemsContainerStyle?: StyleProp<ViewStyle>;
itemStyle?: StyleProp<ViewStyle>;
labelStyle?: StyleProp<TextStyle>;
activeLabelStyle?: StyleProp<TextStyle>;
inactiveLabelStyle?: StyleProp<TextStyle>;
iconContainerStyle?: StyleProp<ViewStyle>;
drawerPosition: 'left' | 'right';
screenProps: unknown;
};
export type DrawerContentComponentProps = DrawerNavigatorItemsProps & {
navigation: NavigationScreenProp<NavigationDrawerState>;
descriptors: SceneDescriptorMap;
drawerOpenProgress: Animated.Node<number>;
screenProps: unknown;
};
export type NavigationDrawerScreenProps<
Params = NavigationParams,
ScreenProps = unknown
> = {
theme: SupportedThemes;
navigation: NavigationDrawerProp<NavigationRoute, Params>;
screenProps: ScreenProps;
};
export type NavigationDrawerScreenComponent<
Params = NavigationParams,
ScreenProps = unknown
> = React.ComponentType<NavigationDrawerScreenProps<Params, ScreenProps>> & {
navigationOptions?: NavigationScreenConfig<
NavigationDrawerOptions,
NavigationDrawerProp<NavigationRoute, Params>,
ScreenProps
>;
};
export type SceneDescriptorMap = {
[key: string]: NavigationDescriptor<
NavigationParams,
NavigationDrawerOptions,
NavigationDrawerProp<NavigationRoute, any>
>;
};