forked from israelias/thrifthub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.tsx
137 lines (110 loc) · 3.63 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
/**
* Learn more about using TypeScript with React Navigation:
* https://reactnavigation.org/docs/typescript/
*/
import { StackNavigationProp } from "@react-navigation/stack";
import { RouteProp } from "@react-navigation/native";
// full_name = models.CharField(max_length=50, null=False, blank=False)
// email = models.EmailField(max_length=254, null=False, blank=False)
// phone_number = models.CharField(max_length=20, null=False, blank=False)
// country = CountryField(blank_label="Country *", null=False, blank=False)
// zipcode = models.CharField(max_length=20, null=True, blank=True)
// town_or_city = models.CharField(max_length=40, null=False, blank=False)
// street_address1 = models.CharField(max_length=80, null=False, blank=False)
// street_address2 = models.CharField(max_length=80, null=True, blank=True)
// county = models.CharField(max_length=80, null=True, blank=True)
// created_at = models.DateTimeField(auto_now_add=True)
// stripe_pid = models.CharField(max_length=254, null=False, blank=False, default="")
// order = models.ForeignKey(Order, related_name="order_detail", on_delete=models.CASCADE)
export type RootStackParamList = {
Root: undefined;
Home: undefined;
Feed: { sort: "latest" | "top" } | undefined;
Profile: { userId: string };
NotFound: undefined;
};
export type LandingStackParamList = {
Home: undefined;
Details: undefined;
};
export type BottomTabParamList = {
TabOne: undefined;
TabTwo: undefined;
};
export type TabOneParamList = {
TabOneScreen: undefined;
};
export type TabTwoParamList = {
TabTwoScreen: undefined;
};
export type RootParamList = {
LandingScreen: undefined;
StoreScreen: undefined;
FavoriteScreen: undefined;
OrderScreen: { paramA: string };
SellScreen: { paramB: string; paramC: number };
BuyScreen: undefined;
};
export type ProductParamList = {
Product: {
name: string;
};
EditProduct: {
name: string;
submit?: React.MutableRefObject<() => void>;
};
};
export type SearchParamList = {
Search: undefined;
} & ProductParamList;
export type SearchStackNavProps<T extends keyof SearchParamList> = {
navigation: StackNavigationProp<SearchParamList, T>;
route: RouteProp<SearchParamList, T>;
};
export type AuthParamList = {
Login: undefined;
Register: undefined;
};
export type AuthNavProps<T extends keyof AuthParamList> = {
navigation: StackNavigationProp<AuthParamList, T>;
route: RouteProp<AuthParamList, T>;
};
export type HomeParamList = {
Feed: undefined;
} & ProductParamList;
export type HomeStackNavProps<T extends keyof HomeParamList> = {
navigation: StackNavigationProp<HomeParamList, T>;
route: RouteProp<HomeParamList, T>;
};
// creating a screen
// const Screen1 = ({ navigation, route }: Screen1Props) => {
// return (
// <>
// <Text>Screen1</Text>
// <Button
// onPress={() => {
// navigation.push("Screen2", { paramA: "Hello!" });
// }}
// />
// </>
// );
// };
// Accessing params from the next screen
// const Screen2 = ({ route }: Screen2Props) => {
// return <Text>{route.params.paramA}</Text>;
// };
// Or
// using hooks to access the route params
// const Screen1 = () => {
// const navigation =
// useNavigation<StackNavigationProp<RootParamList, "Screen1">>();
// const route = useRoute<RouteProp<RootParamList, "Screen1">>();
// // ...
// };
// <NavigationContainer>
// <Root.Navigator>
// <Root.Screen name="Screen1" component={Screen1} />
// <Root.Screen name="Screen2" component={Screen2} />
// <Root.Screen name="Screen3" component={Screen3} />
// </Root.Navigator>
// </NavigationContainer>;