@teamnhz/rn-ui-toolkit 1.4.7 → 1.4.9

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.
@@ -0,0 +1,29 @@
1
+ declare module "@react-native-community/datetimepicker" {
2
+ import * as React from "react";
3
+ import { StyleProp, ViewStyle } from "react-native";
4
+ type DateTimePickerEvent = {
5
+ type: "set" | "dismissed";
6
+ nativeEvent: {
7
+ timestamp?: number;
8
+ };
9
+ };
10
+ type Display = "default" | "spinner" | "clock" | "calendar";
11
+ type AndroidVariant = "nativeAndroid" | "iosClone";
12
+ interface DateTimePickerProps {
13
+ value: Date;
14
+ mode?: "date" | "time" | "datetime";
15
+ display?: Display;
16
+ onChange: (event: DateTimePickerEvent, date?: Date) => void;
17
+ minimumDate?: Date;
18
+ maximumDate?: Date;
19
+ locale?: string;
20
+ timeZoneOffsetInMinutes?: number;
21
+ minuteInterval?: number;
22
+ textColor?: string;
23
+ style?: StyleProp<ViewStyle>;
24
+ is24Hour?: boolean;
25
+ androidVariant?: AndroidVariant;
26
+ }
27
+ export default class DateTimePicker extends React.Component<DateTimePickerProps> {
28
+ }
29
+ }
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { ImageSourcePropType, StyleProp, TextStyle, ViewStyle, ImageStyle } from "react-native";
2
+ import { StyleProp, TextStyle, ViewStyle, ImageStyle, ImageSourcePropType } from "react-native";
3
3
  interface DateTimePickerProps {
4
4
  value: Date | null;
5
5
  onChange: (date: Date) => void;
@@ -8,20 +8,14 @@ interface DateTimePickerProps {
8
8
  intlType?: string;
9
9
  mode?: "date" | "time" | "datetime";
10
10
  disabled?: boolean;
11
- /** raw DatePicker props */
12
11
  minimumDate?: Date;
13
12
  maximumDate?: Date;
14
- modal?: boolean;
15
- confirmText?: string;
16
- cancelText?: string;
17
- /** style overrides */
18
13
  containerStyle?: StyleProp<ViewStyle>;
19
14
  pickerContainerStyle?: StyleProp<ViewStyle>;
20
15
  labelStyle?: StyleProp<TextStyle>;
21
16
  textStyle?: StyleProp<TextStyle>;
22
17
  leftImageStyle?: StyleProp<ImageStyle>;
23
18
  rightImageStyle?: StyleProp<ImageStyle>;
24
- /** icons */
25
19
  leftIcon?: ImageSourcePropType;
26
20
  rightIcon?: ImageSourcePropType;
27
21
  leftIconShow?: boolean;
@@ -29,5 +23,5 @@ interface DateTimePickerProps {
29
23
  error?: string | boolean;
30
24
  errorTextStyle?: StyleProp<TextStyle>;
31
25
  }
32
- declare const DateTimePicker: React.FC<DateTimePickerProps>;
33
- export default DateTimePicker;
26
+ declare const DateTimePickerComponent: React.FC<DateTimePickerProps>;
27
+ export default DateTimePickerComponent;
@@ -1,50 +1,467 @@
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;
1
381
  import React, { useState } from "react";
2
- import { View, TouchableOpacity, Text, StyleSheet, Image, } from "react-native";
3
- import DatePicker from "react-native-date-picker";
382
+ import { View, TouchableOpacity, Text, StyleSheet, Image, Platform, } from "react-native";
383
+ import DateTimePicker from "@react-native-community/datetimepicker";
4
384
  import { useTranslation } from "react-i18next";
5
385
  import { Colors, Scale, Typography, Images } from "../../styles";
6
- const DateTimePicker = ({ value, onChange, label, placeholder, intlType, mode = "date", disabled = false, minimumDate, maximumDate, modal = true, confirmText, cancelText, containerStyle, pickerContainerStyle, labelStyle, textStyle, leftImageStyle, rightImageStyle, leftIcon, rightIcon, leftIconShow, onCancel, error, errorTextStyle, }) => {
386
+ const DateTimePickerComponent = ({ value, onChange, label, placeholder, intlType, mode = "date", disabled = false, minimumDate, maximumDate, containerStyle, pickerContainerStyle, labelStyle, textStyle, leftImageStyle, rightImageStyle, leftIcon, rightIcon, leftIconShow, onCancel, error, errorTextStyle, }) => {
7
387
  const { t } = useTranslation(["common", "validation", "address", "sell"]);
8
- const [open, setOpen] = useState(false);
9
- /** default icons based on mode */
10
- const defaultLeftIcon = mode === "time"
11
- ? Images.ic_time // ⏰ your clock asset
12
- : Images.ic_calendar; // 📅 your calendar asset
388
+ const [show, setShow] = useState(false);
389
+ const [step, setStep] = useState("date");
390
+ const [tempDate, setTempDate] = useState(value || new Date());
391
+ const defaultLeftIcon = mode === "time" ? Images.ic_time : Images.ic_calendar;
13
392
  const getTranslatedLabel = () => {
14
- if (intlType) {
393
+ if (intlType && label) {
15
394
  const translated = t(label, { ns: intlType });
16
395
  if (translated !== label)
17
396
  return translated;
18
397
  }
19
398
  return label;
20
399
  };
400
+ const onChangeHandler = (event, selectedDate) => {
401
+ if (event.type === "dismissed") {
402
+ setShow(false);
403
+ onCancel?.();
404
+ return;
405
+ }
406
+ if (mode === "datetime") {
407
+ if (step === "date") {
408
+ if (selectedDate) {
409
+ setTempDate(selectedDate);
410
+ if (Platform.OS === "android") {
411
+ // open time picker after date
412
+ setStep("time");
413
+ }
414
+ }
415
+ if (Platform.OS === "ios") {
416
+ // iOS can combine date+time with spinner, so just update temp
417
+ if (selectedDate)
418
+ onChange(selectedDate);
419
+ }
420
+ }
421
+ else {
422
+ if (selectedDate) {
423
+ const finalDate = mergeDateAndTime(tempDate, selectedDate);
424
+ onChange(finalDate);
425
+ }
426
+ setShow(false);
427
+ setStep("date");
428
+ }
429
+ }
430
+ else {
431
+ if (selectedDate)
432
+ onChange(selectedDate);
433
+ setShow(Platform.OS === "ios");
434
+ }
435
+ };
436
+ const mergeDateAndTime = (datePart, timePart) => {
437
+ const final = new Date(datePart);
438
+ final.setHours(timePart.getHours());
439
+ final.setMinutes(timePart.getMinutes());
440
+ final.setSeconds(timePart.getSeconds());
441
+ return final;
442
+ };
443
+ const handlePress = () => {
444
+ if (!disabled)
445
+ setShow(true);
446
+ };
21
447
  return (React.createElement(View, { style: containerStyle },
22
- label ? (React.createElement(Text, { style: [styles.label, labelStyle] }, getTranslatedLabel())) : null,
448
+ label && React.createElement(Text, { style: [styles.label, labelStyle] }, getTranslatedLabel()),
23
449
  React.createElement(TouchableOpacity, { style: [
24
450
  styles.button,
25
451
  pickerContainerStyle,
26
452
  disabled && { backgroundColor: Colors.disabledGrey, borderWidth: 0 },
27
- ], disabled: disabled, onPress: () => setOpen(true) },
453
+ ], disabled: disabled, onPress: handlePress },
28
454
  leftIconShow && (React.createElement(Image, { source: leftIcon || defaultLeftIcon, style: [styles.icon, leftImageStyle] })),
29
455
  React.createElement(Text, { style: [styles.text, textStyle, !value && { color: Colors.textGrey }], numberOfLines: 1 }, value ? formatValue(value, mode) : placeholder || "Select"),
30
- rightIcon && (React.createElement(Image, { source: rightIcon, style: [styles.icon, rightImageStyle] }))),
456
+ rightIcon && React.createElement(Image, { source: rightIcon, style: [styles.icon, rightImageStyle] })),
31
457
  typeof error === "string" && error.length > 0 && (React.createElement(Text, { style: [styles.errorText, errorTextStyle] }, error)),
32
- React.createElement(DatePicker, { modal: modal, open: open, date: value || new Date(), mode: mode, minimumDate: minimumDate, maximumDate: maximumDate, confirmText: confirmText, cancelText: cancelText, onConfirm: (val) => {
33
- setOpen(false);
34
- onChange(val);
35
- }, onCancel: () => {
36
- setOpen(false);
37
- onCancel && onCancel();
38
- } })));
458
+ show && (React.createElement(DateTimePicker, { value: value || new Date(), mode: mode === "datetime" ? step : mode, minimumDate: minimumDate, maximumDate: maximumDate, display: Platform.OS === "ios" ? "spinner" : "default", onChange: onChangeHandler }))));
39
459
  };
40
460
  const formatValue = (date, mode) => {
41
461
  try {
42
462
  switch (mode) {
43
463
  case "time":
44
- return date.toLocaleTimeString([], {
45
- hour: "2-digit",
46
- minute: "2-digit",
47
- });
464
+ return date.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
48
465
  case "datetime":
49
466
  return date.toLocaleString();
50
467
  default:
@@ -87,190 +504,4 @@ const styles = StyleSheet.create({
87
504
  marginTop: 3,
88
505
  },
89
506
  });
90
- export default DateTimePicker;
91
- // import React, { useState } from 'react';
92
- // import {
93
- // View,
94
- // TouchableOpacity,
95
- // Text,
96
- // StyleSheet,
97
- // Image,
98
- // ImageSourcePropType,
99
- // StyleProp,
100
- // TextStyle,
101
- // ViewStyle,
102
- // ImageStyle,
103
- // } from 'react-native';
104
- // import DatePicker from 'react-native-date-picker';
105
- // import { useTranslation } from 'react-i18next';
106
- // import { Colors, Scale, Typography, Images } from '../../styles';
107
- // interface DateTimePickerProps {
108
- // value: Date | null;
109
- // onChange: (date: Date) => void;
110
- // label?: string;
111
- // placeholder?: string;
112
- // intlType?: string;
113
- // mode?: 'date' | 'time' | 'datetime';
114
- // disabled?: boolean;
115
- // /** raw DatePicker props */
116
- // minimumDate?: Date;
117
- // maximumDate?: Date;
118
- // modal?: boolean;
119
- // confirmText?: string;
120
- // cancelText?: string;
121
- // /** style overrides */
122
- // containerStyle?: StyleProp<ViewStyle>;
123
- // pickerContainerStyle?: StyleProp<ViewStyle>;
124
- // labelStyle?: StyleProp<TextStyle>;
125
- // textStyle?: StyleProp<TextStyle>;
126
- // leftImageStyle?: StyleProp<ImageStyle>;
127
- // rightImageStyle?: StyleProp<ImageStyle>;
128
- // /** icons */
129
- // leftIcon?: ImageSourcePropType;
130
- // rightIcon?: ImageSourcePropType;
131
- // leftIconShow?: boolean;
132
- // onCancel?: () => void;
133
- // }
134
- // const DateTimePicker: React.FC<DateTimePickerProps> = ({
135
- // value,
136
- // onChange,
137
- // label,
138
- // placeholder,
139
- // intlType,
140
- // mode = 'date',
141
- // disabled = false,
142
- // minimumDate,
143
- // maximumDate,
144
- // modal = true,
145
- // confirmText,
146
- // cancelText,
147
- // containerStyle,
148
- // pickerContainerStyle,
149
- // labelStyle,
150
- // textStyle,
151
- // leftImageStyle,
152
- // rightImageStyle,
153
- // leftIcon,
154
- // rightIcon,
155
- // leftIconShow,
156
- // onCancel,
157
- // }) => {
158
- // const { t } = useTranslation(['common', 'validation', 'address', 'sell']);
159
- // const [open, setOpen] = useState(false);
160
- // /** default icons based on mode */
161
- // const defaultLeftIcon =
162
- // mode === 'time'
163
- // ? Images.ic_time // ⏰ your clock asset
164
- // : Images.ic_calendar; // 📅 your calendar asset
165
- // const getTranslatedLabel = () => {
166
- // if (intlType) {
167
- // const translated = t(label, { ns: intlType });
168
- // if (translated !== label) return translated;
169
- // }
170
- // return label;
171
- // };
172
- // return (
173
- // <View style={[styles.container, containerStyle]}>
174
- // {/* Top label */}
175
- // {label ? (
176
- // <Text style={[styles.label, labelStyle]}>{getTranslatedLabel()}</Text>
177
- // ) : null}
178
- // <TouchableOpacity
179
- // style={[
180
- // styles.button,
181
- // pickerContainerStyle,
182
- // disabled && { backgroundColor: Colors.disabledGrey, borderWidth: 0 },
183
- // ]}
184
- // disabled={disabled}
185
- // onPress={() => setOpen(true)}
186
- // >
187
- // {/* Left icon */}
188
- // {leftIconShow &&
189
- // <Image
190
- // source={leftIcon || defaultLeftIcon}
191
- // style={[styles.icon, leftImageStyle]}
192
- // />}
193
- // {/* Text / Placeholder */}
194
- // <Text
195
- // style={[
196
- // styles.text,
197
- // textStyle,
198
- // !value && { color: Colors.textGrey },
199
- // ]}
200
- // numberOfLines={1}
201
- // >
202
- // {value ? formatValue(value, mode) : placeholder || 'Select'}
203
- // </Text>
204
- // {/* Right icon (mandatory) */}
205
- // {rightIcon &&
206
- // <Image
207
- // source={rightIcon}
208
- // style={[styles.icon, rightImageStyle]}
209
- // />}
210
- // </TouchableOpacity>
211
- // <DatePicker
212
- // modal={modal}
213
- // open={open}
214
- // date={value || new Date()}
215
- // mode={mode}
216
- // minimumDate={minimumDate}
217
- // maximumDate={maximumDate}
218
- // confirmText={confirmText}
219
- // cancelText={cancelText}
220
- // onConfirm={(val) => {
221
- // setOpen(false);
222
- // onChange(val);
223
- // }}
224
- // onCancel={() => {
225
- // setOpen(false);
226
- // onCancel && onCancel();
227
- // }}
228
- // />
229
- // </View>
230
- // );
231
- // };
232
- // const formatValue = (date: Date, mode: 'date' | 'time' | 'datetime') => {
233
- // try {
234
- // switch (mode) {
235
- // case 'time':
236
- // return date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
237
- // case 'datetime':
238
- // return date.toLocaleString();
239
- // default:
240
- // return date.toLocaleDateString();
241
- // }
242
- // } catch {
243
- // return '';
244
- // }
245
- // };
246
- // const styles = StyleSheet.create({
247
- // container: {
248
- // marginVertical: Scale.moderateScale(8),
249
- // },
250
- // label: {
251
- // ...Typography.style.standardU(),
252
- // color: Colors.textColor,
253
- // marginBottom: Scale.moderateScale(8),
254
- // },
255
- // button: {
256
- // borderWidth: 1,
257
- // borderColor: Colors.primaryColor,
258
- // borderRadius: Scale.moderateScale(6),
259
- // paddingVertical: Scale.moderateScale(12),
260
- // paddingHorizontal: Scale.moderateScale(10),
261
- // flexDirection: 'row',
262
- // alignItems: 'center',
263
- // },
264
- // text: {
265
- // flex: 1,
266
- // ...Typography.style.standardU(),
267
- // color: Colors.textColor,
268
- // textTransform: "none",
269
- // },
270
- // icon: {
271
- // width: Scale.moderateScale(20),
272
- // height: Scale.moderateScale(20),
273
- // resizeMode: 'contain',
274
- // },
275
- // });
276
- // export default DateTimePicker;
507
+ export default DateTimePickerComponent;
@@ -38,6 +38,9 @@ interface InputProps extends TextInputProps {
38
38
  isError?: boolean;
39
39
  downArrowIcon?: ImageSourcePropType;
40
40
  downArrowStyle?: object;
41
+ flagIcon?: string;
42
+ flagIconStyle?: object;
43
+ flagContainerStyle?: object;
41
44
  }
42
45
  declare const Input: React.FC<InputProps>;
43
46
  export default Input;
@@ -4,7 +4,7 @@ import { useTranslation } from "react-i18next";
4
4
  import { Colors, Typography, Scale, Images } from "../../styles";
5
5
  import { defaultRegex } from "../../utils/regex";
6
6
  import { messages } from "../../constants/messages";
7
- const Input = ({ intlType, textKey, placeholder, inputPlaceholderTextColor, leftIcon, rightIcon, onLeftIconPress, onRightIconPress, style, containerStyle, inputStyle, errorTextStyle, leftIconStyle, rightIconStyle, leftIconWrapperStyle, rightIconWrapperStyle, type = "text", editable = true, error, value = "", customRegex, customErrorMessage, onChangeText, onValidation, onBlur: restOnBlur, onFocus: restOnFocus, multiline = false, maxLength, returnKeyType, countryCode, onPressCountryCode, countryCodeTextStyle, countryCodeWrapperStyle, isError = true, downArrowIcon, downArrowStyle, ...rest }) => {
7
+ const Input = ({ intlType, textKey, placeholder, inputPlaceholderTextColor, leftIcon, rightIcon, onLeftIconPress, onRightIconPress, style, containerStyle, inputStyle, errorTextStyle, leftIconStyle, rightIconStyle, leftIconWrapperStyle, rightIconWrapperStyle, type = "text", editable = true, error, value = "", customRegex, customErrorMessage, onChangeText, onValidation, onBlur: restOnBlur, onFocus: restOnFocus, multiline = false, maxLength, returnKeyType, countryCode, onPressCountryCode, countryCodeTextStyle, countryCodeWrapperStyle, isError = true, downArrowIcon, downArrowStyle, flagIcon, flagIconStyle, flagContainerStyle, ...rest }) => {
8
8
  const { t } = useTranslation();
9
9
  const [secureText, setSecureText] = useState(type === "password");
10
10
  const [internalError, setInternalError] = useState(null);
@@ -84,6 +84,22 @@ const Input = ({ intlType, textKey, placeholder, inputPlaceholderTextColor, left
84
84
  ] },
85
85
  leftIcon && (React.createElement(TouchableOpacity, { onPress: onLeftIconPress, disabled: !onLeftIconPress, style: [styles.iconWrapper, leftIconWrapperStyle] },
86
86
  React.createElement(Image, { source: leftIcon, style: [styles.icon, leftIconStyle], resizeMode: "contain" }))),
87
+ flagIcon && countryCode && (React.createElement(TouchableOpacity, { onPress: onLeftIconPress, disabled: !onLeftIconPress, style: [
88
+ styles.iconWrapper,
89
+ {
90
+ width: "auto", // Remove fixed width
91
+ height: "auto", // Remove fixed height
92
+ padding: Scale.moderateScale(6),
93
+ },
94
+ leftIconWrapperStyle,
95
+ ] },
96
+ React.createElement(Text, { style: [
97
+ {
98
+ fontSize: 25,
99
+ lineHeight: 25,
100
+ },
101
+ flagIconStyle,
102
+ ] }, flagIcon))),
87
103
  countryCode && (React.createElement(TouchableOpacity, { onPress: onPressCountryCode, disabled: !onPressCountryCode, style: [styles.countryCodeWrapper, countryCodeWrapperStyle] },
88
104
  React.createElement(View, { style: styles.rowCenter },
89
105
  React.createElement(Image, { source: downArrowIcon || Images.down_arrow // <-- Your default arrow
@@ -1,22 +1,3 @@
1
- // import { setColorConfig } from "./colors";
2
- // import { setTypographyConfig } from "./typography";
3
- // export type AppConfig = {
4
- // colors?: Record<string, string>;
5
- // fonts?: any;
6
- // sizes?: any;
7
- // lang?: any;
8
- // scaleFn?: any;
9
- // };
10
- // export function setAppConfig(config: AppConfig) {
11
- // if (config.colors) setColorConfig(config.colors);
12
- // setTypographyConfig({
13
- // fonts: config.fonts,
14
- // sizes: config.sizes,
15
- // lang: config.lang,
16
- // scaleFn: config.scaleFn,
17
- // });
18
- // }
19
- // appConfig.js
20
1
  let appLanguage = "en"; // en | hi
21
2
  let customFonts = {
22
3
  en: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamnhz/rn-ui-toolkit",
3
- "version": "1.4.7",
3
+ "version": "1.4.9",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -17,13 +17,16 @@
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",
20
+ "react-native-compressor": "^1.13.0",
21
21
  "react-native-element-dropdown": "^2.12.4",
22
22
  "react-native-elements": "^3.4.3",
23
+ "react-native-fs": "^2.20.0",
23
24
  "react-native-gesture-handler": "^2.26.0",
24
25
  "react-native-image-crop-picker": "^0.51.1",
25
26
  "react-native-image-picker": "^8.2.0",
27
+ "react-native-image-resizer": "^1.4.5",
26
28
  "react-native-keyboard-aware-scroll-view": "^0.9.5",
29
+ "react-native-linear-gradient": "^2.8.3",
27
30
  "react-native-modal": "^14.0.0-rc.1",
28
31
  "react-native-permissions": "^4.1.5",
29
32
  "react-native-reanimated": "^3.17.5",
@@ -31,10 +34,7 @@
31
34
  "react-native-svg": "^15.12.1",
32
35
  "react-native-vector-icons": "^10.3.0",
33
36
  "react-native-video-trim": "^3.0.9",
34
- "react-native-compressor": "^1.13.0",
35
- "react-native-fs": "^2.20.0",
36
- "react-native-linear-gradient": "^2.8.3",
37
- "react-native-image-resizer":"^1.4.5"
37
+ "@react-native-community/datetimepicker": "^8.5.0"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@react-native-documents/picker": "^10.1.5",