/
types.ts
99 lines (84 loc) · 3.01 KB
/
types.ts
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
import {CompositeNavigationProp, RouteProp} from '@react-navigation/native';
import {StackNavigationProp} from '@react-navigation/stack';
import {BottomTabNavigationProp} from '@react-navigation/bottom-tabs';
type NestedNavigatorParams<ParamList> = {
[K in keyof ParamList]?: {screen: K; params?: ParamList[K]};
}[keyof ParamList];
// for useNavigation hook
export type AuthNavigationType<RouteName extends keyof AuthRoutes> =
CompositeNavigationProp<
StackNavigationProp<AuthRoutes, RouteName>,
StackNavigationProp<AppRoutes, 'DrawerNavigator'>
>;
export type AuthNavigationProps<RouteName extends keyof AuthRoutes> = {
navigation: StackNavigationProp<AuthRoutes, RouteName>;
route: RouteProp<AuthRoutes, RouteName>;
};
// for useNavigation hook
export type BottomTabNavigationType<RouteName extends keyof BottomTabRoutes> =
StackNavigationProp<BottomTabRoutes, RouteName>;
export type BottomTabNavigationProps<RouteName extends keyof BottomTabRoutes> =
{
navigation: BottomTabNavigationProp<BottomTabRoutes, RouteName>;
route: RouteProp<BottomTabRoutes, RouteName>;
};
// for useNavigation hook
export type DrawerNavigationType<RouteName extends keyof DrawerRoutes> =
CompositeNavigationProp<
StackNavigationProp<DrawerRoutes, RouteName>,
StackNavigationProp<AppRoutes, 'DrawerNavigator'>
>;
export type DrawerNavigationProps<RouteName extends keyof DrawerRoutes> = {
navigation: CompositeNavigationProp<
StackNavigationProp<DrawerRoutes, RouteName>,
BottomTabNavigationProp<BottomTabRoutes>
>;
route: RouteProp<DrawerRoutes, RouteName>;
};
// for useNavigation hook
export type AppNavigationType<RouteName extends keyof AppRoutes> =
StackNavigationProp<AppRoutes, RouteName>;
// for useNavigation hook
export type ModalNavigationType<RouteName extends keyof ModalRoutes> =
CompositeNavigationProp<
StackNavigationProp<ModalRoutes, RouteName>,
StackNavigationProp<AppRoutes, 'ModalRoutes'>
>;
export type ModalNavigationProps<RouteName extends keyof ModalRoutes> = {
navigation: StackNavigationProp<ModalRoutes, RouteName>;
route: RouteProp<ModalRoutes, RouteName>;
};
export type AppRoutes = {
AuthStackNavigation: NestedNavigatorParams<AuthRoutes>;
DrawerNavigator: NestedNavigatorParams<DrawerRoutes>;
Home: NestedNavigatorParams<BottomTabRoutes>;
ModalRoutes: NestedNavigatorParams<DrawerRoutes>;
};
export type BottomTabRoutes = {
Dashboard: undefined;
Calendar: undefined;
RequestModal: undefined;
Panel: undefined;
Chat: undefined;
};
export type DrawerRoutes = {
Home: NestedNavigatorParams<BottomTabRoutes>;
EditProfile: undefined;
HolidayBudget: undefined;
About: undefined;
Settings: undefined;
};
export type AuthRoutes = {
Slider: undefined;
Login: undefined;
Signup: undefined;
SignupEmail: undefined;
ForgotPassword: undefined;
RecoveryCode: undefined;
NewPassword: undefined;
ConfirmedAccount: undefined;
};
export type ModalRoutes = {
RequestVacation: undefined;
DrawerNavigator: NestedNavigatorParams<DrawerRoutes>;
};