@towsila/expo-ui-library 4.11.5 → 4.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/package.json +1 -1
  2. package/src/components/reusable/templateSubPage.tsx +46 -31
  3. package/src/components/screens/AddReportScreen.tsx +55 -61
  4. package/src/components/screens/LegalScreen.tsx +27 -30
  5. package/src/components/screens/VerificationCodeScreen.tsx +4 -2
  6. package/src/components/screens/confirmDeleteScreen.tsx +81 -27
  7. package/src/components/screens/forgotPasswordScreen.tsx +15 -12
  8. package/src/components/screens/loginScreen.tsx +183 -79
  9. package/src/components/screens/onBoarding.tsx +98 -73
  10. package/src/components/screens/profileScreen.tsx +84 -32
  11. package/src/components/screens/resetPassword.tsx +3 -0
  12. package/src/components/screens/signUpScreen.tsx +98 -93
  13. package/src/components/screens/sucessScreen.tsx +75 -28
  14. package/src/components/ui/AnimatedSuccessIcon.tsx +15 -8
  15. package/src/components/ui/OTPInput.tsx +59 -17
  16. package/src/components/ui/PageTopBar.tsx +45 -33
  17. package/src/components/ui/customPopup.tsx +78 -86
  18. package/src/components/ui/dynamicForm.tsx +49 -18
  19. package/src/components/ui/input.tsx +102 -65
  20. package/src/components/ui/navigationCard.tsx +60 -47
  21. package/src/components/ui/pageIndicator.tsx +42 -18
  22. package/src/components/ui/requestCard.tsx +161 -105
  23. package/src/components/ui/requestCardSkeleton.tsx +38 -0
  24. package/src/components/ui/select.tsx +49 -33
  25. package/src/components/ui/sharpButton.tsx +37 -20
  26. package/src/components/ui/skeleton.tsx +38 -0
  27. package/src/components/ui/termsPopup.tsx +74 -45
  28. package/src/components/ui/textArea.tsx +37 -40
  29. package/src/components/ui/toast.tsx +49 -52
@@ -1,58 +1,71 @@
1
1
  import { Ionicons } from "@expo/vector-icons";
2
- import { View , Text, TouchableOpacity} from "react-native";
2
+ import { View, Text, TouchableOpacity } from "react-native";
3
3
  import { SvgProps } from "react-native-svg";
4
4
  import { useAppTheme } from "../../context/ThemeContext";
5
5
  import { useLanguage } from "../../context/LanguageContext";
6
6
  import { Fonts, textSize } from "../../tokens/typography";
7
7
 
8
- interface Props{
9
- icon: React.ComponentType<SvgProps>,
10
- label: string;
11
- onNavigate:()=>void
8
+ interface Props {
9
+ icon: React.ComponentType<SvgProps>;
10
+ label: string;
11
+ onNavigate: () => void;
12
12
  }
13
- export default function NavigationRow({icon: Icon, label, onNavigate}:Props){
14
- const {colors} = useAppTheme();
15
- const {isRTL} = useLanguage();
16
- const arrow: keyof typeof Ionicons.glyphMap = isRTL
13
+
14
+ export default function NavigationRow({ icon: Icon, label, onNavigate }: Props) {
15
+ const { colors } = useAppTheme();
16
+ const { isRTL } = useLanguage();
17
+
18
+ const arrow: keyof typeof Ionicons.glyphMap = isRTL
17
19
  ? "chevron-back-outline"
18
20
  : "chevron-forward-outline";
19
- const align = isRTL ? "row-reverse":"row";
20
- return(
21
- <TouchableOpacity
22
- onPress={onNavigate}
21
+ const align = isRTL ? "row-reverse" : "row";
22
+
23
+ return (
24
+ <TouchableOpacity
25
+ onPress={onNavigate}
26
+ activeOpacity={0.7}
27
+ accessibilityRole="button"
28
+ accessibilityLabel={label}
29
+ style={{
30
+ flexDirection: align,
31
+ justifyContent: "space-between",
32
+ alignItems: "center",
33
+ minHeight: 48, // proper touch target
34
+ paddingVertical: 12,
35
+ paddingHorizontal: 4,
36
+ }}
37
+ >
38
+ <View
39
+ style={{
40
+ flexDirection: align,
41
+ gap: 14, // was 20 — less wasted space on small screens
42
+ alignItems: "center",
43
+ flex: 1, // take remaining width, shrink Text inside
44
+ minWidth: 0, // allows Text to truncate
45
+ }}
46
+ >
47
+ <Icon width={22} height={22} color={colors.text.primary} />
48
+ <Text
49
+ numberOfLines={1}
50
+ style={{
51
+ flexShrink: 1, // long labels truncate instead of pushing chevron
52
+ fontFamily: Fonts.montserrat.semiBold,
53
+ fontSize: textSize.md,
54
+ color: colors.text.primary,
55
+ }}
56
+ >
57
+ {label}
58
+ </Text>
59
+ </View>
60
+ <View
23
61
  style={{
24
- flexDirection:align,
25
- justifyContent:"space-between",
26
- alignItems:"center"
27
- }}>
28
- <View style={{
29
- flexDirection:align,
30
- gap: 20,
31
- alignItems:"center"
32
- }}>
33
- <Icon width={22} height={22} color={colors.text.primary}/>
34
- <Text style={{
35
- fontFamily: Fonts.montserrat.semiBold,
36
- fontSize: textSize.md,
37
- color: colors.text.primary
38
- }}
39
- >
40
- {label}
41
- </Text>
42
- </View>
43
- <View
44
- style={{
45
- width: 24,
46
- alignItems: "center",
47
- flexShrink: 0,
48
- }}
49
- >
50
- <Ionicons
51
- name={arrow}
52
- size={18}
53
- color={colors.text.secondary}
54
- />
55
- </View>
56
- </TouchableOpacity>
57
- )
62
+ width: 24,
63
+ alignItems: "center",
64
+ flexShrink: 0,
65
+ }}
66
+ >
67
+ <Ionicons name={arrow} size={18} color={colors.text.secondary} />
68
+ </View>
69
+ </TouchableOpacity>
70
+ );
58
71
  }
@@ -8,38 +8,62 @@ type Props = {
8
8
  current?: number;
9
9
  textColor: string;
10
10
  color?: string;
11
- defaultColor:string;
11
+ defaultColor: string;
12
12
  };
13
13
 
14
14
  const BAR_HEIGHT = 6;
15
+
15
16
  export default function PageIndicator({
16
- stepsLabel="Steps",
17
+ stepsLabel = "Steps",
17
18
  total = 3,
18
19
  current = 1,
19
20
  textColor = "black",
20
21
  color = "white",
21
22
  defaultColor,
22
23
  }: Props) {
23
- const {isRTL} = useLanguage();
24
+ const { isRTL } = useLanguage();
24
25
  return (
25
- <View style={{ alignItems: isRTL ? "flex-end" : "flex-start", gap: 15, width: "100%" }}>
26
- <Text style={{ color: textColor, fontSize: textSize.md, fontFamily: Fonts.montserrat.semiBold }}>
27
- {stepsLabel}
28
- </Text>
26
+ <View
27
+ style={{
28
+ alignItems: isRTL ? "flex-end" : "flex-start",
29
+ gap: 15,
30
+ width: "100%",
31
+ }}
32
+ >
33
+ <Text
34
+ numberOfLines={1}
35
+ style={{
36
+ color: textColor,
37
+ fontSize: textSize.md,
38
+ fontFamily: Fonts.montserrat.semiBold,
39
+ textAlign: isRTL ? "right" : "left",
40
+ }}
41
+ >
42
+ {stepsLabel}
43
+ </Text>
29
44
 
30
- <View style={{ flexDirection: isRTL ? "row-reverse" : "row", gap: 8, width: "100%" }}>
31
- {Array.from({ length: total }).map((_, index) => (
32
45
  <View
33
- key={index}
34
46
  style={{
35
- flex: 1,
36
- height: BAR_HEIGHT,
37
- borderRadius: BAR_HEIGHT / 2,
38
- backgroundColor: current >= index ? color : defaultColor,
47
+ flexDirection: isRTL ? "row-reverse" : "row",
48
+ gap: 8,
49
+ width: "100%",
39
50
  }}
40
- />
41
- ))}
42
- </View>
43
- </View>
51
+ >
52
+ {Array.from({ length: total }).map((_, index) => (
53
+ <View
54
+ key={index}
55
+ accessibilityRole="progressbar"
56
+ accessibilityLabel={`Step ${index + 1} of ${total}`}
57
+ accessibilityValue={{ min: 0, max: total, now: current }}
58
+ style={{
59
+ flex: 1,
60
+ height: BAR_HEIGHT,
61
+ borderRadius: BAR_HEIGHT / 2,
62
+ backgroundColor: current >= index ? color : defaultColor,
63
+ }}
64
+ />
65
+ ))}
66
+ </View>
67
+ </View>
44
68
  );
45
69
  }
@@ -7,29 +7,37 @@ import { SvgProps } from "react-native-svg";
7
7
  import { useAppTheme } from "../../context/ThemeContext";
8
8
  import { useRelativeTime } from "../../hooks/useRelativeTime";
9
9
  import { useLanguage } from "../../context/LanguageContext";
10
- import {Request} from "../../types/request";
10
+ import { Request } from "../../types/request";
11
11
  import { Fonts, textSize } from "../../tokens/typography";
12
12
  import CircularCountdown from "./circularCountdown";
13
13
  import { formatPrice } from "../../utils/formatPrice";
14
+
14
15
  export default function RequestCard({
15
16
  request,
16
17
  addRow = false,
17
- onExpire,
18
+ onExpire,
18
19
  t,
19
- locationName,
20
+ locationName,
20
21
  destinationName,
21
- }: { request: Request, addRow?: boolean, onExpire?: (id:string)=>void, t: (key: string, opts?: any) => string; locationName: string; destinationName: string;}) {
22
- const {colors} = useAppTheme();
23
- const formatRelative = useRelativeTime(t);
24
- const {isRTL} = useLanguage();
22
+ }: {
23
+ request: Request;
24
+ addRow?: boolean;
25
+ onExpire?: (id: string) => void;
26
+ t: (key: string, opts?: any) => string;
27
+ locationName: string;
28
+ destinationName: string;
29
+ }) {
30
+ const { colors } = useAppTheme();
31
+ const formatRelative = useRelativeTime(t);
32
+ const { isRTL } = useLanguage();
25
33
  const statusColors = {
26
34
  PENDING: colors.semantic.warning,
27
35
  CONFIRMED: colors.semantic.success,
28
36
  REJECTED: colors.semantic.error,
29
37
  CANCELLED: colors.text.placeholder,
30
38
  AWAITING_PICK_UP: colors.semantic.warning,
31
- PICK_UP:colors.semantic.warning,
32
- DROP_OFF:colors.semantic.warning,
39
+ PICK_UP: colors.semantic.warning,
40
+ DROP_OFF: colors.semantic.warning,
33
41
  EXPIRED: colors.text.placeholder,
34
42
  };
35
43
 
@@ -38,147 +46,195 @@ export default function RequestCard({
38
46
  CONFIRMED: t("request.status.CONFIRMED"),
39
47
  REJECTED: t("request.status.REJECTED"),
40
48
  CANCELLED: t("request.status.CANCELLED"),
41
- AWAITING_PICK_UP:t("request.status.AWAITING_PICK_UP"),
42
- PICK_UP:t("request.status.PICK_UP"),
43
- DROP_OFF:t("request.status.DROP_OFF"),
44
- EXPIRED: t("request.status.EXPIRED")
49
+ AWAITING_PICK_UP: t("request.status.AWAITING_PICK_UP"),
50
+ PICK_UP: t("request.status.PICK_UP"),
51
+ DROP_OFF: t("request.status.DROP_OFF"),
52
+ EXPIRED: t("request.status.EXPIRED"),
45
53
  };
46
- const result = t("request.time.ago", { time: formatRelative(request.time) });
47
-
48
- // const locationName = shortAddress(usePlaceName(request.location)); // [lat, lng]
49
- // const destinationName =shortAddress(usePlaceName(request.destination));
50
- const carStateText = request.carState
51
- .map((s) => t(`request.carStateEnum.${s}`))
52
- .join(" - ");
54
+ const result = t("request.time.ago", { time: formatRelative(request.time) });
53
55
 
56
+ const carStateText = request.carState
57
+ .map((s) => t(`request.carStateEnum.${s}`))
58
+ .join(" - ");
54
59
 
55
60
  const deadline = new Date(request.time).getTime() + 2 * 60 * 1000;
56
- const align = isRTL ?"row-reverse":"row";
61
+ const align = isRTL ? "row-reverse" : "row";
62
+
57
63
  return (
58
64
  <View
59
65
  style={{
60
66
  backgroundColor: colors.background.card,
61
67
  borderRadius: 15,
62
68
  padding: 12,
63
- // marginBottom: 0,
64
69
  borderWidth: 1.5,
65
70
  borderColor: colors.text.primary,
66
- gap: 10
71
+ gap: 10,
67
72
  }}
68
73
  >
69
- <View style={{gap: 5}}>
70
- <View style={{
71
- flexDirection:align,
74
+ <View style={{ gap: 5 }}>
75
+ <View
76
+ style={{
77
+ flexDirection: align,
72
78
  justifyContent: "space-between",
73
- }}>
74
- <Text
75
- style={{
76
- fontSize: textSize.lg,
77
- fontFamily: Fonts.montserrat.bold,
78
- color: colors.text.primary,
79
- }}
80
- >
81
- {request.name}
82
- </Text>
83
- <View
79
+ alignItems: "center",
80
+ gap: 8,
81
+ }}
82
+ >
83
+ <Text
84
+ numberOfLines={1}
84
85
  style={{
85
- backgroundColor: statusColors[request.status] + "20",
86
- paddingHorizontal: 10,
87
- paddingVertical: 4,
88
- borderRadius: 20,
86
+ flexShrink: 1,
87
+ minWidth: 0,
88
+ fontSize: textSize.lg,
89
+ fontFamily: Fonts.montserrat.bold,
90
+ color: colors.text.primary,
89
91
  }}
92
+ >
93
+ {request.name}
94
+ </Text>
95
+ <View
96
+ style={{
97
+ flexShrink: 0,
98
+ backgroundColor: statusColors[request.status] + "20",
99
+ paddingHorizontal: 10,
100
+ paddingVertical: 4,
101
+ borderRadius: 20,
102
+ }}
103
+ >
104
+ <Text
105
+ numberOfLines={1}
106
+ style={{
107
+ fontSize: textSize.sm,
108
+ fontFamily: Fonts.montserrat.regular,
109
+ color: statusColors[request.status],
110
+ }}
90
111
  >
91
- <Text
92
- style={{
93
- fontSize: textSize.sm,
94
- fontFamily: Fonts.montserrat.regular,
95
- color: statusColors[request.status],
96
- }}
97
- >
98
- {statusLabels[request.status]}
99
- </Text>
100
- </View>
112
+ {statusLabels[request.status]}
113
+ </Text>
114
+ </View>
101
115
  </View>
102
116
  {addRow && (
103
- <View style={{
104
- flexDirection: align,
105
- justifyContent: "space-between",
106
- alignItems: "center",
107
- }}>
108
- <Text style={{
117
+ <View
118
+ style={{
119
+ flexDirection: align,
120
+ justifyContent: "space-between",
121
+ alignItems: "center",
122
+ gap: 8,
123
+ }}
124
+ >
125
+ <Text
126
+ numberOfLines={1}
127
+ style={{
128
+ flexShrink: 1,
129
+ minWidth: 0,
109
130
  fontSize: textSize.xs,
110
- fontFamily: Fonts.montserrat.regular,
111
- color:colors.text.secondary
112
- }}>
131
+ fontFamily: Fonts.montserrat.regular,
132
+ color: colors.text.secondary,
133
+ }}
134
+ >
113
135
  {request.phone} · {t(`request.vehicleType.${request.vehicleType}`)}
114
136
  </Text>
115
137
  {request.status === "PENDING" ? (
116
- <CircularCountdown deadline={deadline} onExpire={() => onExpire?.(request.id)}/>
117
- ):(
118
- <View style={{flexDirection: align, alignItems: "center", gap: 4}}>
119
- <View style={[isRTL && {transform :[{scaleX:-1}]}]}>
120
- <Clock width={13} height={13} color={colors.text.placeholder} />
138
+ <CircularCountdown
139
+ deadline={deadline}
140
+ onExpire={() => onExpire?.(request.id)}
141
+ />
142
+ ) : (
143
+ <View
144
+ style={{
145
+ flexDirection: align,
146
+ alignItems: "center",
147
+ gap: 4,
148
+ flexShrink: 0,
149
+ }}
150
+ >
151
+ <View style={[isRTL && { transform: [{ scaleX: -1 }] }]}>
152
+ <Clock width={13} height={13} color={colors.text.placeholder} />
121
153
  </View>
122
154
  <Text
123
- style={{
124
- fontSize: textSize.xs,
155
+ numberOfLines={1}
156
+ style={{
157
+ fontSize: textSize.xs,
125
158
  fontFamily: Fonts.montserrat.regular,
126
159
  color: colors.text.placeholder,
127
- }}
160
+ }}
128
161
  >
129
- {result}
162
+ {result}
130
163
  </Text>
131
- </View>
164
+ </View>
132
165
  )}
133
-
134
- </View>
166
+ </View>
135
167
  )}
136
- </View>
137
- <CardRow icon={Destination} label={t("request.pickUp")} value={locationName}/>
138
- <CardRow icon={Flag} label={t("request.destination")} value={destinationName}/>
139
- <CardRow icon={Warning} label={t("request.carState")} value={carStateText}/>
140
- <View style={{borderWidth:0.5, borderColor: colors.semantic.border}}/>
141
- <View
142
- style={{
143
- flexDirection: align,
144
- justifyContent: "space-between",
145
- gap: 10,
146
- }}
147
- >
148
- <Text
168
+ </View>
169
+ <CardRow
170
+ icon={Destination}
171
+ label={t("request.pickUp")}
172
+ value={locationName}
173
+ />
174
+ <CardRow
175
+ icon={Flag}
176
+ label={t("request.destination")}
177
+ value={destinationName}
178
+ />
179
+ <CardRow
180
+ icon={Warning}
181
+ label={t("request.carState")}
182
+ value={carStateText}
183
+ />
184
+ <View
185
+ style={{ borderWidth: 0.5, borderColor: colors.semantic.border }}
186
+ />
187
+ <View
149
188
  style={{
150
- color: colors.text.secondary,
151
- fontSize: textSize.sm,
152
- fontFamily: Fonts.montserrat.regular,
189
+ flexDirection: align,
190
+ justifyContent: "space-between",
191
+ gap: 10,
153
192
  }}
154
193
  >
155
- {t("request.total")}
156
- </Text>
157
- <Text
158
- style={[
159
- {
194
+ <Text
195
+ style={{
196
+ flexShrink: 1,
197
+ minWidth: 0,
198
+ color: colors.text.secondary,
199
+ fontSize: textSize.sm,
200
+ fontFamily: Fonts.montserrat.regular,
201
+ }}
202
+ >
203
+ {t("request.total")}
204
+ </Text>
205
+ <Text
206
+ numberOfLines={1}
207
+ style={{
208
+ flexShrink: 0,
160
209
  color: colors.text.primary,
161
210
  fontSize: textSize.md,
162
211
  fontFamily: Fonts.montserrat.semiBold,
163
- },
164
- ]}
165
- >
166
- {`${formatPrice(request.price)} ${t("request.price.unit")}`}
167
- </Text>
168
- </View>
212
+ }}
213
+ >
214
+ {`${formatPrice(request.price)} ${t("request.price.unit")}`}
215
+ </Text>
169
216
  </View>
217
+ </View>
170
218
  );
171
219
  }
172
220
 
173
- function CardRow({ icon: Icon, label, value }: { icon: React.ComponentType<SvgProps>; label: string; value: string }) {
221
+ function CardRow({
222
+ icon: Icon,
223
+ label,
224
+ value,
225
+ }: {
226
+ icon: React.ComponentType<SvgProps>;
227
+ label: string;
228
+ value: string;
229
+ }) {
174
230
  const { isRTL } = useLanguage();
175
231
  const { colors } = useAppTheme();
176
- const align = isRTL? "row-reverse":"row";
177
- const text = isRTL?"right":"left";
232
+ const align = isRTL ? "row-reverse" : "row";
233
+ const text = isRTL ? "right" : "left";
178
234
  return (
179
235
  <View
180
236
  style={{
181
- flexDirection:align,
237
+ flexDirection: align,
182
238
  alignItems: "center",
183
239
  gap: 10,
184
240
  }}
@@ -186,7 +242,7 @@ function CardRow({ icon: Icon, label, value }: { icon: React.ComponentType<SvgPr
186
242
  <View style={{ flexShrink: 0 }}>
187
243
  <Icon color={colors.primary} width={20} height={20} />
188
244
  </View>
189
- <View style={{ flex: 1 }}>
245
+ <View style={{ flex: 1, minWidth: 0 }}>
190
246
  <Text
191
247
  style={{
192
248
  fontSize: textSize.sm,
@@ -203,7 +259,7 @@ function CardRow({ icon: Icon, label, value }: { icon: React.ComponentType<SvgPr
203
259
  fontSize: textSize.sm,
204
260
  fontFamily: Fonts.montserrat.regular,
205
261
  color: colors.text.primary,
206
- textAlign:text,
262
+ textAlign: text,
207
263
  }}
208
264
  >
209
265
  {value}
@@ -0,0 +1,38 @@
1
+ import { View } from "react-native";
2
+ import Skeleton from "./skeleton";
3
+ import { useLanguage } from "../../context/LanguageContext";
4
+ import { useAppTheme } from "../../context/ThemeContext";
5
+
6
+ export function RequestCardSkeleton() {
7
+ const { colors } = useAppTheme();
8
+ const {isRTL} = useLanguage();
9
+ return (
10
+ <View
11
+ style={{
12
+ backgroundColor: colors.background.card,
13
+ borderRadius: 15,
14
+ padding: 12,
15
+ borderWidth: 1.5,
16
+ borderColor: colors.semantic.border,
17
+ gap: 12,
18
+ }}
19
+ >
20
+ <View style={{ flexDirection: isRTL? "row-reverse":"row", justifyContent: "space-between" }}>
21
+ <Skeleton width={140} height={20} />
22
+ <Skeleton width={70} height={22} radius={11} />
23
+ </View>
24
+ <View style={{ flexDirection: isRTL? "row-reverse":"row", justifyContent: "space-between" }}>
25
+ <Skeleton width={140} height={20} />
26
+ <Skeleton width={70} height={22} radius={11} />
27
+ </View>
28
+ <Skeleton height={36} />
29
+ <Skeleton height={36} />
30
+ <Skeleton height={36} />
31
+ <Skeleton height={1} />
32
+ <View style={{ flexDirection: isRTL? "row-reverse":"row", justifyContent: "space-between" }}>
33
+ <Skeleton width={140} height={20} />
34
+ <Skeleton width={70} height={22} radius={11} />
35
+ </View>
36
+ </View>
37
+ );
38
+ }