@teamnhz/rn-ui-toolkit 1.0.8 → 1.1.1
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.
|
@@ -1,383 +1,3 @@
|
|
|
1
|
-
// import React, { useState } from "react";
|
|
2
|
-
// import {
|
|
3
|
-
// View,
|
|
4
|
-
// TouchableOpacity,
|
|
5
|
-
// Text,
|
|
6
|
-
// StyleSheet,
|
|
7
|
-
// Image,
|
|
8
|
-
// ImageSourcePropType,
|
|
9
|
-
// StyleProp,
|
|
10
|
-
// TextStyle,
|
|
11
|
-
// ViewStyle,
|
|
12
|
-
// ImageStyle,
|
|
13
|
-
// } from "react-native";
|
|
14
|
-
// import DatePicker from "react-native-date-picker";
|
|
15
|
-
// import { useTranslation } from "react-i18next";
|
|
16
|
-
// import { Colors, Scale, Typography, Images } from "../../styles";
|
|
17
|
-
// interface DateTimePickerProps {
|
|
18
|
-
// value: Date | null;
|
|
19
|
-
// onChange: (date: Date) => void;
|
|
20
|
-
// label?: string;
|
|
21
|
-
// placeholder?: string;
|
|
22
|
-
// intlType?: string;
|
|
23
|
-
// mode?: "date" | "time" | "datetime";
|
|
24
|
-
// disabled?: boolean;
|
|
25
|
-
// /** raw DatePicker props */
|
|
26
|
-
// minimumDate?: Date;
|
|
27
|
-
// maximumDate?: Date;
|
|
28
|
-
// modal?: boolean;
|
|
29
|
-
// confirmText?: string;
|
|
30
|
-
// cancelText?: string;
|
|
31
|
-
// /** style overrides */
|
|
32
|
-
// containerStyle?: StyleProp<ViewStyle>;
|
|
33
|
-
// pickerContainerStyle?: StyleProp<ViewStyle>;
|
|
34
|
-
// labelStyle?: StyleProp<TextStyle>;
|
|
35
|
-
// textStyle?: StyleProp<TextStyle>;
|
|
36
|
-
// leftImageStyle?: StyleProp<ImageStyle>;
|
|
37
|
-
// rightImageStyle?: StyleProp<ImageStyle>;
|
|
38
|
-
// /** icons */
|
|
39
|
-
// leftIcon?: ImageSourcePropType;
|
|
40
|
-
// rightIcon?: ImageSourcePropType;
|
|
41
|
-
// leftIconShow?: boolean;
|
|
42
|
-
// onCancel?: () => void;
|
|
43
|
-
// error?: string | boolean;
|
|
44
|
-
// errorTextStyle?: StyleProp<TextStyle>;
|
|
45
|
-
// }
|
|
46
|
-
// const DateTimePicker: React.FC<DateTimePickerProps> = ({
|
|
47
|
-
// value,
|
|
48
|
-
// onChange,
|
|
49
|
-
// label,
|
|
50
|
-
// placeholder,
|
|
51
|
-
// intlType,
|
|
52
|
-
// mode = "date",
|
|
53
|
-
// disabled = false,
|
|
54
|
-
// minimumDate,
|
|
55
|
-
// maximumDate,
|
|
56
|
-
// modal = true,
|
|
57
|
-
// confirmText,
|
|
58
|
-
// cancelText,
|
|
59
|
-
// containerStyle,
|
|
60
|
-
// pickerContainerStyle,
|
|
61
|
-
// labelStyle,
|
|
62
|
-
// textStyle,
|
|
63
|
-
// leftImageStyle,
|
|
64
|
-
// rightImageStyle,
|
|
65
|
-
// leftIcon,
|
|
66
|
-
// rightIcon,
|
|
67
|
-
// leftIconShow,
|
|
68
|
-
// onCancel,
|
|
69
|
-
// error,
|
|
70
|
-
// errorTextStyle,
|
|
71
|
-
// }) => {
|
|
72
|
-
// const { t } = useTranslation(["common", "validation", "address", "sell"]);
|
|
73
|
-
// const [open, setOpen] = useState(false);
|
|
74
|
-
// /** default icons based on mode */
|
|
75
|
-
// const defaultLeftIcon =
|
|
76
|
-
// mode === "time"
|
|
77
|
-
// ? Images.ic_time // ⏰ your clock asset
|
|
78
|
-
// : Images.ic_calendar; // 📅 your calendar asset
|
|
79
|
-
// const getTranslatedLabel = () => {
|
|
80
|
-
// if (intlType) {
|
|
81
|
-
// const translated = t(label, { ns: intlType });
|
|
82
|
-
// if (translated !== label) return translated;
|
|
83
|
-
// }
|
|
84
|
-
// return label;
|
|
85
|
-
// };
|
|
86
|
-
// return (
|
|
87
|
-
// <View style={containerStyle}>
|
|
88
|
-
// {/* Top label */}
|
|
89
|
-
// {label ? (
|
|
90
|
-
// <Text style={[styles.label, labelStyle]}>{getTranslatedLabel()}</Text>
|
|
91
|
-
// ) : null}
|
|
92
|
-
// <TouchableOpacity
|
|
93
|
-
// style={[
|
|
94
|
-
// styles.button,
|
|
95
|
-
// pickerContainerStyle,
|
|
96
|
-
// disabled && { backgroundColor: Colors.disabledGrey, borderWidth: 0 },
|
|
97
|
-
// ]}
|
|
98
|
-
// disabled={disabled}
|
|
99
|
-
// onPress={() => setOpen(true)}
|
|
100
|
-
// >
|
|
101
|
-
// {/* Left icon */}
|
|
102
|
-
// {leftIconShow && (
|
|
103
|
-
// <Image
|
|
104
|
-
// source={leftIcon || defaultLeftIcon}
|
|
105
|
-
// style={[styles.icon, leftImageStyle]}
|
|
106
|
-
// />
|
|
107
|
-
// )}
|
|
108
|
-
// {/* Text / Placeholder */}
|
|
109
|
-
// <Text
|
|
110
|
-
// style={[styles.text, textStyle, !value && { color: Colors.textGrey }]}
|
|
111
|
-
// numberOfLines={1}
|
|
112
|
-
// >
|
|
113
|
-
// {value ? formatValue(value, mode) : placeholder || "Select"}
|
|
114
|
-
// </Text>
|
|
115
|
-
// {/* Right icon (mandatory) */}
|
|
116
|
-
// {rightIcon && (
|
|
117
|
-
// <Image source={rightIcon} style={[styles.icon, rightImageStyle]} />
|
|
118
|
-
// )}
|
|
119
|
-
// </TouchableOpacity>
|
|
120
|
-
// {/* Error text */}
|
|
121
|
-
// {typeof error === "string" && error.length > 0 && (
|
|
122
|
-
// <Text style={[styles.errorText, errorTextStyle]}>{error}</Text>
|
|
123
|
-
// )}
|
|
124
|
-
// <DatePicker
|
|
125
|
-
// modal={modal}
|
|
126
|
-
// open={open}
|
|
127
|
-
// date={value || new Date()}
|
|
128
|
-
// mode={mode}
|
|
129
|
-
// minimumDate={minimumDate}
|
|
130
|
-
// maximumDate={maximumDate}
|
|
131
|
-
// confirmText={confirmText}
|
|
132
|
-
// cancelText={cancelText}
|
|
133
|
-
// onConfirm={(val) => {
|
|
134
|
-
// setOpen(false);
|
|
135
|
-
// onChange(val);
|
|
136
|
-
// }}
|
|
137
|
-
// onCancel={() => {
|
|
138
|
-
// setOpen(false);
|
|
139
|
-
// onCancel && onCancel();
|
|
140
|
-
// }}
|
|
141
|
-
// />
|
|
142
|
-
// </View>
|
|
143
|
-
// );
|
|
144
|
-
// };
|
|
145
|
-
// const formatValue = (date: Date, mode: "date" | "time" | "datetime") => {
|
|
146
|
-
// try {
|
|
147
|
-
// switch (mode) {
|
|
148
|
-
// case "time":
|
|
149
|
-
// return date.toLocaleTimeString([], {
|
|
150
|
-
// hour: "2-digit",
|
|
151
|
-
// minute: "2-digit",
|
|
152
|
-
// });
|
|
153
|
-
// case "datetime":
|
|
154
|
-
// return date.toLocaleString();
|
|
155
|
-
// default:
|
|
156
|
-
// return date.toLocaleDateString();
|
|
157
|
-
// }
|
|
158
|
-
// } catch {
|
|
159
|
-
// return "";
|
|
160
|
-
// }
|
|
161
|
-
// };
|
|
162
|
-
// const styles = StyleSheet.create({
|
|
163
|
-
// label: {
|
|
164
|
-
// ...Typography.style.standardU(),
|
|
165
|
-
// color: Colors.textColor,
|
|
166
|
-
// marginBottom: Scale.moderateScale(8),
|
|
167
|
-
// },
|
|
168
|
-
// button: {
|
|
169
|
-
// borderWidth: 1,
|
|
170
|
-
// borderColor: Colors.primaryColor,
|
|
171
|
-
// borderRadius: Scale.moderateScale(6),
|
|
172
|
-
// paddingVertical: Scale.moderateScale(12),
|
|
173
|
-
// paddingHorizontal: Scale.moderateScale(10),
|
|
174
|
-
// flexDirection: "row",
|
|
175
|
-
// alignItems: "center",
|
|
176
|
-
// },
|
|
177
|
-
// text: {
|
|
178
|
-
// flex: 1,
|
|
179
|
-
// ...Typography.style.standardU(),
|
|
180
|
-
// color: Colors.textColor,
|
|
181
|
-
// textTransform: "none",
|
|
182
|
-
// },
|
|
183
|
-
// icon: {
|
|
184
|
-
// width: Scale.moderateScale(20),
|
|
185
|
-
// height: Scale.moderateScale(20),
|
|
186
|
-
// resizeMode: "contain",
|
|
187
|
-
// },
|
|
188
|
-
// errorText: {
|
|
189
|
-
// color: Colors.dangerRed,
|
|
190
|
-
// fontSize: Scale.moderateScale(12),
|
|
191
|
-
// marginTop: 3,
|
|
192
|
-
// },
|
|
193
|
-
// });
|
|
194
|
-
// export default DateTimePicker;
|
|
195
|
-
// import React, { useState } from 'react';
|
|
196
|
-
// import {
|
|
197
|
-
// View,
|
|
198
|
-
// TouchableOpacity,
|
|
199
|
-
// Text,
|
|
200
|
-
// StyleSheet,
|
|
201
|
-
// Image,
|
|
202
|
-
// ImageSourcePropType,
|
|
203
|
-
// StyleProp,
|
|
204
|
-
// TextStyle,
|
|
205
|
-
// ViewStyle,
|
|
206
|
-
// ImageStyle,
|
|
207
|
-
// } from 'react-native';
|
|
208
|
-
// import DatePicker from 'react-native-date-picker';
|
|
209
|
-
// import { useTranslation } from 'react-i18next';
|
|
210
|
-
// import { Colors, Scale, Typography, Images } from '../../styles';
|
|
211
|
-
// interface DateTimePickerProps {
|
|
212
|
-
// value: Date | null;
|
|
213
|
-
// onChange: (date: Date) => void;
|
|
214
|
-
// label?: string;
|
|
215
|
-
// placeholder?: string;
|
|
216
|
-
// intlType?: string;
|
|
217
|
-
// mode?: 'date' | 'time' | 'datetime';
|
|
218
|
-
// disabled?: boolean;
|
|
219
|
-
// /** raw DatePicker props */
|
|
220
|
-
// minimumDate?: Date;
|
|
221
|
-
// maximumDate?: Date;
|
|
222
|
-
// modal?: boolean;
|
|
223
|
-
// confirmText?: string;
|
|
224
|
-
// cancelText?: string;
|
|
225
|
-
// /** style overrides */
|
|
226
|
-
// containerStyle?: StyleProp<ViewStyle>;
|
|
227
|
-
// pickerContainerStyle?: StyleProp<ViewStyle>;
|
|
228
|
-
// labelStyle?: StyleProp<TextStyle>;
|
|
229
|
-
// textStyle?: StyleProp<TextStyle>;
|
|
230
|
-
// leftImageStyle?: StyleProp<ImageStyle>;
|
|
231
|
-
// rightImageStyle?: StyleProp<ImageStyle>;
|
|
232
|
-
// /** icons */
|
|
233
|
-
// leftIcon?: ImageSourcePropType;
|
|
234
|
-
// rightIcon?: ImageSourcePropType;
|
|
235
|
-
// leftIconShow?: boolean;
|
|
236
|
-
// onCancel?: () => void;
|
|
237
|
-
// }
|
|
238
|
-
// const DateTimePicker: React.FC<DateTimePickerProps> = ({
|
|
239
|
-
// value,
|
|
240
|
-
// onChange,
|
|
241
|
-
// label,
|
|
242
|
-
// placeholder,
|
|
243
|
-
// intlType,
|
|
244
|
-
// mode = 'date',
|
|
245
|
-
// disabled = false,
|
|
246
|
-
// minimumDate,
|
|
247
|
-
// maximumDate,
|
|
248
|
-
// modal = true,
|
|
249
|
-
// confirmText,
|
|
250
|
-
// cancelText,
|
|
251
|
-
// containerStyle,
|
|
252
|
-
// pickerContainerStyle,
|
|
253
|
-
// labelStyle,
|
|
254
|
-
// textStyle,
|
|
255
|
-
// leftImageStyle,
|
|
256
|
-
// rightImageStyle,
|
|
257
|
-
// leftIcon,
|
|
258
|
-
// rightIcon,
|
|
259
|
-
// leftIconShow,
|
|
260
|
-
// onCancel,
|
|
261
|
-
// }) => {
|
|
262
|
-
// const { t } = useTranslation(['common', 'validation', 'address', 'sell']);
|
|
263
|
-
// const [open, setOpen] = useState(false);
|
|
264
|
-
// /** default icons based on mode */
|
|
265
|
-
// const defaultLeftIcon =
|
|
266
|
-
// mode === 'time'
|
|
267
|
-
// ? Images.ic_time // ⏰ your clock asset
|
|
268
|
-
// : Images.ic_calendar; // 📅 your calendar asset
|
|
269
|
-
// const getTranslatedLabel = () => {
|
|
270
|
-
// if (intlType) {
|
|
271
|
-
// const translated = t(label, { ns: intlType });
|
|
272
|
-
// if (translated !== label) return translated;
|
|
273
|
-
// }
|
|
274
|
-
// return label;
|
|
275
|
-
// };
|
|
276
|
-
// return (
|
|
277
|
-
// <View style={[styles.container, containerStyle]}>
|
|
278
|
-
// {/* Top label */}
|
|
279
|
-
// {label ? (
|
|
280
|
-
// <Text style={[styles.label, labelStyle]}>{getTranslatedLabel()}</Text>
|
|
281
|
-
// ) : null}
|
|
282
|
-
// <TouchableOpacity
|
|
283
|
-
// style={[
|
|
284
|
-
// styles.button,
|
|
285
|
-
// pickerContainerStyle,
|
|
286
|
-
// disabled && { backgroundColor: Colors.disabledGrey, borderWidth: 0 },
|
|
287
|
-
// ]}
|
|
288
|
-
// disabled={disabled}
|
|
289
|
-
// onPress={() => setOpen(true)}
|
|
290
|
-
// >
|
|
291
|
-
// {/* Left icon */}
|
|
292
|
-
// {leftIconShow &&
|
|
293
|
-
// <Image
|
|
294
|
-
// source={leftIcon || defaultLeftIcon}
|
|
295
|
-
// style={[styles.icon, leftImageStyle]}
|
|
296
|
-
// />}
|
|
297
|
-
// {/* Text / Placeholder */}
|
|
298
|
-
// <Text
|
|
299
|
-
// style={[
|
|
300
|
-
// styles.text,
|
|
301
|
-
// textStyle,
|
|
302
|
-
// !value && { color: Colors.textGrey },
|
|
303
|
-
// ]}
|
|
304
|
-
// numberOfLines={1}
|
|
305
|
-
// >
|
|
306
|
-
// {value ? formatValue(value, mode) : placeholder || 'Select'}
|
|
307
|
-
// </Text>
|
|
308
|
-
// {/* Right icon (mandatory) */}
|
|
309
|
-
// {rightIcon &&
|
|
310
|
-
// <Image
|
|
311
|
-
// source={rightIcon}
|
|
312
|
-
// style={[styles.icon, rightImageStyle]}
|
|
313
|
-
// />}
|
|
314
|
-
// </TouchableOpacity>
|
|
315
|
-
// <DatePicker
|
|
316
|
-
// modal={modal}
|
|
317
|
-
// open={open}
|
|
318
|
-
// date={value || new Date()}
|
|
319
|
-
// mode={mode}
|
|
320
|
-
// minimumDate={minimumDate}
|
|
321
|
-
// maximumDate={maximumDate}
|
|
322
|
-
// confirmText={confirmText}
|
|
323
|
-
// cancelText={cancelText}
|
|
324
|
-
// onConfirm={(val) => {
|
|
325
|
-
// setOpen(false);
|
|
326
|
-
// onChange(val);
|
|
327
|
-
// }}
|
|
328
|
-
// onCancel={() => {
|
|
329
|
-
// setOpen(false);
|
|
330
|
-
// onCancel && onCancel();
|
|
331
|
-
// }}
|
|
332
|
-
// />
|
|
333
|
-
// </View>
|
|
334
|
-
// );
|
|
335
|
-
// };
|
|
336
|
-
// const formatValue = (date: Date, mode: 'date' | 'time' | 'datetime') => {
|
|
337
|
-
// try {
|
|
338
|
-
// switch (mode) {
|
|
339
|
-
// case 'time':
|
|
340
|
-
// return date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
|
|
341
|
-
// case 'datetime':
|
|
342
|
-
// return date.toLocaleString();
|
|
343
|
-
// default:
|
|
344
|
-
// return date.toLocaleDateString();
|
|
345
|
-
// }
|
|
346
|
-
// } catch {
|
|
347
|
-
// return '';
|
|
348
|
-
// }
|
|
349
|
-
// };
|
|
350
|
-
// const styles = StyleSheet.create({
|
|
351
|
-
// container: {
|
|
352
|
-
// marginVertical: Scale.moderateScale(8),
|
|
353
|
-
// },
|
|
354
|
-
// label: {
|
|
355
|
-
// ...Typography.style.standardU(),
|
|
356
|
-
// color: Colors.textColor,
|
|
357
|
-
// marginBottom: Scale.moderateScale(8),
|
|
358
|
-
// },
|
|
359
|
-
// button: {
|
|
360
|
-
// borderWidth: 1,
|
|
361
|
-
// borderColor: Colors.primaryColor,
|
|
362
|
-
// borderRadius: Scale.moderateScale(6),
|
|
363
|
-
// paddingVertical: Scale.moderateScale(12),
|
|
364
|
-
// paddingHorizontal: Scale.moderateScale(10),
|
|
365
|
-
// flexDirection: 'row',
|
|
366
|
-
// alignItems: 'center',
|
|
367
|
-
// },
|
|
368
|
-
// text: {
|
|
369
|
-
// flex: 1,
|
|
370
|
-
// ...Typography.style.standardU(),
|
|
371
|
-
// color: Colors.textColor,
|
|
372
|
-
// textTransform: "none",
|
|
373
|
-
// },
|
|
374
|
-
// icon: {
|
|
375
|
-
// width: Scale.moderateScale(20),
|
|
376
|
-
// height: Scale.moderateScale(20),
|
|
377
|
-
// resizeMode: 'contain',
|
|
378
|
-
// },
|
|
379
|
-
// });
|
|
380
|
-
// export default DateTimePicker;
|
|
381
1
|
import React, { useState } from "react";
|
|
382
2
|
import { View, TouchableOpacity, Text, StyleSheet, Image, } from "react-native";
|
|
383
3
|
import DateTimePickerModal from "react-native-modal-datetime-picker";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamnhz/rn-ui-toolkit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
"react": ">=19.0.0",
|
|
18
18
|
"react-i18next": "^15.7.2",
|
|
19
19
|
"react-native": ">=0.77.2",
|
|
20
|
-
"react-native-date-picker": "^5.0.13",
|
|
21
20
|
"react-native-element-dropdown": "^2.12.4",
|
|
22
21
|
"react-native-elements": "^3.4.3",
|
|
23
22
|
"react-native-fast-image": "^8.6.3",
|
|
@@ -31,7 +30,10 @@
|
|
|
31
30
|
"react-native-safe-area-context": "^5.6.1",
|
|
32
31
|
"react-native-svg": "^15.12.1",
|
|
33
32
|
"react-native-vector-icons": "^10.3.0",
|
|
34
|
-
"react-native-video-trim": "^3.0.9"
|
|
33
|
+
"react-native-video-trim": "^3.0.9",
|
|
34
|
+
"@react-native-community/datetimepicker": "^8.4.4",
|
|
35
|
+
"react-native-modal-datetime-picker": "^18.0.0"
|
|
36
|
+
|
|
35
37
|
},
|
|
36
38
|
"devDependencies": {
|
|
37
39
|
"@react-native-documents/picker": "^10.1.5",
|
|
@@ -39,8 +41,5 @@
|
|
|
39
41
|
"react-native-keyboard-aware-scroll-view": "^0.9.5",
|
|
40
42
|
"typescript": "^5.9.2"
|
|
41
43
|
},
|
|
42
|
-
"dependencies": {
|
|
43
|
-
"@react-native-community/datetimepicker": "^8.5.0",
|
|
44
|
-
"react-native-modal-datetime-picker": "^18.0.0"
|
|
45
|
-
}
|
|
44
|
+
"dependencies": {}
|
|
46
45
|
}
|