react-native-better-html 1.0.11 → 1.0.13
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.
- package/dist/index.d.mts +102 -58
- package/dist/index.d.ts +102 -58
- package/dist/index.js +359 -103
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +373 -116
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -52,6 +52,7 @@ __export(index_exports, {
|
|
|
52
52
|
formatPhoneNumber: () => import_react_better_core11.formatPhoneNumber,
|
|
53
53
|
generateAsyncStorage: () => generateAsyncStorage,
|
|
54
54
|
generateRandomString: () => import_react_better_core11.generateRandomString,
|
|
55
|
+
getFormErrorObject: () => getFormErrorObject,
|
|
55
56
|
getPluralWord: () => import_react_better_core11.getPluralWord,
|
|
56
57
|
lightenColor: () => import_react_better_core11.lightenColor,
|
|
57
58
|
loaderControls: () => import_react_better_core11.loaderControls,
|
|
@@ -61,6 +62,7 @@ __export(index_exports, {
|
|
|
61
62
|
useBooleanState: () => import_react_better_core11.useBooleanState,
|
|
62
63
|
useDebounceState: () => import_react_better_core11.useDebounceState,
|
|
63
64
|
useDevice: () => useDevice,
|
|
65
|
+
useForm: () => useForm,
|
|
64
66
|
useKeyboard: () => useKeyboard,
|
|
65
67
|
useLoader: () => import_react_better_core11.useLoader,
|
|
66
68
|
useLoaderControls: () => import_react_better_core11.useLoaderControls,
|
|
@@ -465,6 +467,129 @@ function useComponentPropsGrouper(props, prefix) {
|
|
|
465
467
|
};
|
|
466
468
|
}, [props, prefix]);
|
|
467
469
|
}
|
|
470
|
+
function useForm(options) {
|
|
471
|
+
const { defaultValues, requiredFields, additional, onSubmit, validate } = options;
|
|
472
|
+
const inputFieldRefs = (0, import_react2.useRef)(
|
|
473
|
+
{}
|
|
474
|
+
);
|
|
475
|
+
const [values, setValues] = (0, import_react2.useState)(defaultValues);
|
|
476
|
+
const [errors, setErrors] = (0, import_react2.useState)({});
|
|
477
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react_better_core2.useBooleanState)();
|
|
478
|
+
const numberOfInputFields = Object.keys(defaultValues).length;
|
|
479
|
+
const setFieldValue = (0, import_react2.useCallback)(
|
|
480
|
+
(field, value) => {
|
|
481
|
+
setValues((oldValue) => ({
|
|
482
|
+
...oldValue,
|
|
483
|
+
[field]: value
|
|
484
|
+
}));
|
|
485
|
+
setErrors((oldValue) => ({
|
|
486
|
+
...oldValue,
|
|
487
|
+
[field]: void 0
|
|
488
|
+
}));
|
|
489
|
+
},
|
|
490
|
+
[]
|
|
491
|
+
);
|
|
492
|
+
const setFieldsValue = (0, import_react2.useCallback)((values2) => {
|
|
493
|
+
setValues((oldValue) => ({
|
|
494
|
+
...oldValue,
|
|
495
|
+
...values2
|
|
496
|
+
}));
|
|
497
|
+
setErrors((oldValue) => {
|
|
498
|
+
const newErrors = {};
|
|
499
|
+
for (const key in values2) newErrors[key] = void 0;
|
|
500
|
+
return newErrors;
|
|
501
|
+
});
|
|
502
|
+
}, []);
|
|
503
|
+
const focusField = (0, import_react2.useCallback)((field) => {
|
|
504
|
+
inputFieldRefs.current[field]?.focus();
|
|
505
|
+
}, []);
|
|
506
|
+
const validateForm = (0, import_react2.useCallback)(() => {
|
|
507
|
+
const validationErrors = validate?.(values) || {};
|
|
508
|
+
setErrors(validationErrors);
|
|
509
|
+
return validationErrors;
|
|
510
|
+
}, [validate, values]);
|
|
511
|
+
const onSubmitFunction = (0, import_react2.useCallback)(
|
|
512
|
+
async (event) => {
|
|
513
|
+
event?.preventDefault();
|
|
514
|
+
setIsSubmitting.setTrue();
|
|
515
|
+
try {
|
|
516
|
+
const validationErrors = validateForm();
|
|
517
|
+
if (Object.keys(validationErrors).length === 0) {
|
|
518
|
+
await onSubmit?.(values);
|
|
519
|
+
} else {
|
|
520
|
+
const firstErrorField = Object.keys(validationErrors)[0];
|
|
521
|
+
focusField(firstErrorField);
|
|
522
|
+
}
|
|
523
|
+
} finally {
|
|
524
|
+
setIsSubmitting.setFalse();
|
|
525
|
+
}
|
|
526
|
+
},
|
|
527
|
+
[values, validateForm, onSubmit, focusField]
|
|
528
|
+
);
|
|
529
|
+
const getInputFieldProps = (0, import_react2.useCallback)(
|
|
530
|
+
(field) => {
|
|
531
|
+
const thisInputFieldIndex = Object.keys(values).findIndex((key) => key === field);
|
|
532
|
+
const isLastInputField = thisInputFieldIndex === numberOfInputFields - 1;
|
|
533
|
+
return {
|
|
534
|
+
required: requiredFields?.includes(field),
|
|
535
|
+
value: values[field]?.toString() ?? "",
|
|
536
|
+
errorMessage: errors[field],
|
|
537
|
+
isError: !!errors[field],
|
|
538
|
+
returnKeyLabel: isLastInputField ? additional?.lastInputFieldReturnKeyLabel ?? "done" : "next",
|
|
539
|
+
onPressEnter: () => {
|
|
540
|
+
if (isLastInputField) onSubmitFunction();
|
|
541
|
+
else inputFieldRefs.current[Object.keys(values)[thisInputFieldIndex + 1]]?.focus();
|
|
542
|
+
},
|
|
543
|
+
onChange: (value) => {
|
|
544
|
+
setFieldValue(field, value);
|
|
545
|
+
},
|
|
546
|
+
ref: (element) => {
|
|
547
|
+
if (!element) return;
|
|
548
|
+
inputFieldRefs.current[field] = element;
|
|
549
|
+
}
|
|
550
|
+
};
|
|
551
|
+
},
|
|
552
|
+
[values, setFieldValue, errors, requiredFields, additional, onSubmitFunction]
|
|
553
|
+
);
|
|
554
|
+
const reset = (0, import_react2.useCallback)(() => {
|
|
555
|
+
setValues(defaultValues);
|
|
556
|
+
setErrors({});
|
|
557
|
+
}, [defaultValues]);
|
|
558
|
+
const isDirty = (0, import_react2.useMemo)(
|
|
559
|
+
() => Object.keys(defaultValues).some((key) => defaultValues[key] !== values[key]),
|
|
560
|
+
[defaultValues, values]
|
|
561
|
+
);
|
|
562
|
+
const isValid = (0, import_react2.useMemo)(() => {
|
|
563
|
+
const validationErrors = validate?.(values) || {};
|
|
564
|
+
return Object.keys(validationErrors).length === 0;
|
|
565
|
+
}, [validate, values]);
|
|
566
|
+
const canSubmit = (0, import_react2.useMemo)(() => {
|
|
567
|
+
const requiredFieldsHaveValues = requiredFields?.every((field) => values[field] !== void 0 && values[field] !== "") ?? true;
|
|
568
|
+
return isValid && requiredFieldsHaveValues;
|
|
569
|
+
}, [isValid, requiredFields]);
|
|
570
|
+
return {
|
|
571
|
+
values,
|
|
572
|
+
errors,
|
|
573
|
+
isSubmitting,
|
|
574
|
+
setFieldValue,
|
|
575
|
+
setFieldsValue,
|
|
576
|
+
getInputFieldProps,
|
|
577
|
+
focusField,
|
|
578
|
+
inputFieldRefs: inputFieldRefs.current,
|
|
579
|
+
validate: validateForm,
|
|
580
|
+
onSubmit: onSubmitFunction,
|
|
581
|
+
reset,
|
|
582
|
+
requiredFields,
|
|
583
|
+
isDirty,
|
|
584
|
+
isValid,
|
|
585
|
+
canSubmit
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
// src/utils/functions.ts
|
|
590
|
+
var getFormErrorObject = (formValues) => {
|
|
591
|
+
return {};
|
|
592
|
+
};
|
|
468
593
|
|
|
469
594
|
// src/utils/asyncStorage.ts
|
|
470
595
|
var import_async_storage = __toESM(require("@react-native-async-storage/async-storage"));
|
|
@@ -498,6 +623,7 @@ var import_react_native2 = require("react-native");
|
|
|
498
623
|
var import_react_better_core3 = require("react-better-core");
|
|
499
624
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
500
625
|
var touchableHighlightStyleMoveToContent = [
|
|
626
|
+
"width",
|
|
501
627
|
"backgroundColor",
|
|
502
628
|
"padding",
|
|
503
629
|
"paddingTop",
|
|
@@ -638,6 +764,7 @@ var ViewComponent = function View({
|
|
|
638
764
|
ViewComponent,
|
|
639
765
|
{
|
|
640
766
|
width: "100%",
|
|
767
|
+
height: props.height,
|
|
641
768
|
borderRadius: props.borderRadius,
|
|
642
769
|
borderTopLeftRadius: props.borderTopLeftRadius,
|
|
643
770
|
borderTopRightRadius: props.borderTopRightRadius,
|
|
@@ -1177,11 +1304,14 @@ var Image_default = Image2;
|
|
|
1177
1304
|
// src/components/InputField.tsx
|
|
1178
1305
|
var import_react10 = require("react");
|
|
1179
1306
|
var import_react_native8 = require("react-native");
|
|
1307
|
+
var import_datetimepicker = __toESM(require("@react-native-community/datetimepicker"));
|
|
1180
1308
|
var import_react_better_core9 = require("react-better-core");
|
|
1181
1309
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1182
1310
|
var InputFieldComponent = (0, import_react10.forwardRef)(
|
|
1183
1311
|
({
|
|
1184
1312
|
placeholder,
|
|
1313
|
+
type = "text",
|
|
1314
|
+
iOSDateTimeFullSize,
|
|
1185
1315
|
prefix,
|
|
1186
1316
|
suffix,
|
|
1187
1317
|
defaultValue,
|
|
@@ -1205,23 +1335,67 @@ var InputFieldComponent = (0, import_react10.forwardRef)(
|
|
|
1205
1335
|
fontWeight = 400,
|
|
1206
1336
|
lineHeight = 20,
|
|
1207
1337
|
textAlign,
|
|
1338
|
+
required,
|
|
1339
|
+
disabled,
|
|
1340
|
+
maxLength,
|
|
1341
|
+
multiline,
|
|
1342
|
+
numberOfLines = 2,
|
|
1208
1343
|
paddingHorizontal,
|
|
1209
1344
|
paddingVertical,
|
|
1210
1345
|
onFocus,
|
|
1211
1346
|
onBlur,
|
|
1212
1347
|
onChange,
|
|
1213
1348
|
onPress,
|
|
1349
|
+
onPressPrefix,
|
|
1350
|
+
onPressSuffix,
|
|
1214
1351
|
onPressEnter
|
|
1215
1352
|
}, ref) => {
|
|
1216
1353
|
const theme2 = (0, import_react_better_core9.useTheme)();
|
|
1217
1354
|
const { colorTheme } = (0, import_react_better_core9.useBetterCoreContext)();
|
|
1218
1355
|
const textInputRef = (0, import_react10.useRef)(null);
|
|
1219
1356
|
const [internalValue, setInternalValue] = (0, import_react10.useState)(value?.toString() || defaultValue || "");
|
|
1357
|
+
const [internalDateValue, setInternalDateValue] = (0, import_react10.useState)();
|
|
1220
1358
|
const [isFocused, setIsFocused] = (0, import_react_better_core9.useBooleanState)();
|
|
1359
|
+
const isIOSDateTime = import_react_native8.Platform.OS === "ios" && (type === "date" || type === "time");
|
|
1221
1360
|
const borderWidth = 1;
|
|
1222
1361
|
const readyPaddingHorizontal = paddingHorizontal ?? theme2.styles.space;
|
|
1223
1362
|
const readyPaddingVertical = paddingVertical ? parseFloat(paddingVertical.toString()) : (theme2.styles.space + theme2.styles.gap) / 2;
|
|
1224
|
-
const readyHeight = height ?? borderWidth + readyPaddingVertical + lineHeight + readyPaddingVertical + borderWidth;
|
|
1363
|
+
const readyHeight = height ?? isIOSDateTime ? void 0 : borderWidth + readyPaddingVertical + lineHeight + readyPaddingVertical + borderWidth + (import_react_native8.Platform.OS === "android" ? 2 : 0);
|
|
1364
|
+
const onChangeRNDateTimePicker = (0, import_react10.useCallback)(
|
|
1365
|
+
(event, data) => {
|
|
1366
|
+
setInternalDateValue(data);
|
|
1367
|
+
onChange?.(data?.toISOString() ?? "");
|
|
1368
|
+
},
|
|
1369
|
+
[onChange]
|
|
1370
|
+
);
|
|
1371
|
+
const onPressInputField = (0, import_react10.useCallback)(
|
|
1372
|
+
(event) => {
|
|
1373
|
+
onPress?.(event);
|
|
1374
|
+
if (type === "date" || type === "time") {
|
|
1375
|
+
if (import_react_native8.Platform.OS === "android") {
|
|
1376
|
+
import_datetimepicker.DateTimePickerAndroid.open({
|
|
1377
|
+
value: internalDateValue ?? /* @__PURE__ */ new Date(),
|
|
1378
|
+
is24Hour: true,
|
|
1379
|
+
mode: type,
|
|
1380
|
+
positiveButton: {
|
|
1381
|
+
label: "Done"
|
|
1382
|
+
},
|
|
1383
|
+
negativeButton: {
|
|
1384
|
+
label: "Clear",
|
|
1385
|
+
textColor: theme2.colors.textSecondary
|
|
1386
|
+
},
|
|
1387
|
+
neutralButton: {
|
|
1388
|
+
label: "Cancel",
|
|
1389
|
+
textColor: theme2.colors.textSecondary
|
|
1390
|
+
},
|
|
1391
|
+
onChange: onChangeRNDateTimePicker
|
|
1392
|
+
});
|
|
1393
|
+
} else if (import_react_native8.Platform.OS === "ios") {
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
},
|
|
1397
|
+
[onPress, type, internalDateValue, onChangeRNDateTimePicker]
|
|
1398
|
+
);
|
|
1225
1399
|
const onFocusElement = (0, import_react10.useCallback)((event) => {
|
|
1226
1400
|
setIsFocused.setTrue();
|
|
1227
1401
|
onFocus?.(event);
|
|
@@ -1249,10 +1423,27 @@ var InputFieldComponent = (0, import_react10.forwardRef)(
|
|
|
1249
1423
|
}),
|
|
1250
1424
|
[theme2.colors, fontSize, fontWeight, lineHeight, readyPaddingHorizontal, readyPaddingVertical]
|
|
1251
1425
|
);
|
|
1426
|
+
const rnDateTimePickerStyle = (0, import_react10.useMemo)(
|
|
1427
|
+
() => ({
|
|
1428
|
+
flex: iOSDateTimeFullSize ? 1 : void 0,
|
|
1429
|
+
marginLeft: -8 + (iOSDateTimeFullSize ? 0 : theme2.styles.space)
|
|
1430
|
+
}),
|
|
1431
|
+
[iOSDateTimeFullSize]
|
|
1432
|
+
);
|
|
1252
1433
|
(0, import_react10.useEffect)(() => {
|
|
1253
1434
|
if (value === void 0) return;
|
|
1254
1435
|
setInternalValue(value.toString());
|
|
1436
|
+
setInternalDateValue(new Date(value));
|
|
1255
1437
|
}, [value]);
|
|
1438
|
+
(0, import_react10.useEffect)(() => {
|
|
1439
|
+
if (type !== "date" && type !== "time") return;
|
|
1440
|
+
const date = internalDateValue?.toISOString().split("T")[0] ?? "";
|
|
1441
|
+
const hours = internalDateValue ? internalDateValue.getHours().toString() : "00";
|
|
1442
|
+
const minutes = internalDateValue ? internalDateValue.getMinutes().toString() : "00";
|
|
1443
|
+
setInternalValue(
|
|
1444
|
+
type === "date" ? date : internalDateValue ? `${hours.length === 1 ? `0${hours}` : hours}:${minutes.length === 1 ? `0${minutes}` : minutes}` : ""
|
|
1445
|
+
);
|
|
1446
|
+
}, [internalDateValue]);
|
|
1256
1447
|
(0, import_react10.useImperativeHandle)(
|
|
1257
1448
|
ref,
|
|
1258
1449
|
() => {
|
|
@@ -1260,112 +1451,175 @@ var InputFieldComponent = (0, import_react10.forwardRef)(
|
|
|
1260
1451
|
},
|
|
1261
1452
|
[]
|
|
1262
1453
|
);
|
|
1454
|
+
const withPressInputField = !!onPress || type === "date" || type === "time";
|
|
1263
1455
|
const prefixSuffixBackgroundColor = colorTheme === "light" ? (0, import_react_better_core9.darkenColor)(theme2.colors.backgroundContent, 0.03) : (0, import_react_better_core9.lightenColor)(theme2.colors.backgroundContent, 0.1);
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1456
|
+
const labelComponent = label && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(View_default, { isRow: true, alignItems: "center", gap: 2, children: [
|
|
1457
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text_default, { fontSize: 14, color: isError ? theme2.colors.error : theme2.colors.textSecondary, children: label }),
|
|
1458
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text_default, { color: theme2.colors.error, children: "*" })
|
|
1459
|
+
] });
|
|
1460
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1461
|
+
Animate_default.View,
|
|
1462
|
+
{
|
|
1463
|
+
flex: 1,
|
|
1464
|
+
gap: theme2.styles.gap / 3,
|
|
1465
|
+
initialOpacity: 1,
|
|
1466
|
+
animateOpacity: disabled ? 0.6 : 1,
|
|
1467
|
+
children: [
|
|
1468
|
+
isIOSDateTime && !iOSDateTimeFullSize ? void 0 : labelComponent,
|
|
1469
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(View_default, { isRow: true, position: "relative", alignItems: "center", flex: 1, height: readyHeight, children: [
|
|
1470
|
+
prefix && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1471
|
+
View_default,
|
|
1472
|
+
{
|
|
1473
|
+
isRow: true,
|
|
1474
|
+
height: "100%",
|
|
1475
|
+
backgroundColor: prefixSuffixBackgroundColor,
|
|
1476
|
+
alignItems: "center",
|
|
1477
|
+
justifyContent: "center",
|
|
1478
|
+
borderWidth,
|
|
1479
|
+
borderRightWidth: 0,
|
|
1480
|
+
borderTopLeftRadius: theme2.styles.borderRadius,
|
|
1481
|
+
borderBottomLeftRadius: theme2.styles.borderRadius,
|
|
1482
|
+
borderColor: theme2.colors.border,
|
|
1483
|
+
paddingHorizontal: readyPaddingHorizontal,
|
|
1484
|
+
onPress: onPressPrefix,
|
|
1485
|
+
children: typeof prefix === "string" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1486
|
+
Text_default,
|
|
1487
|
+
{
|
|
1488
|
+
fontWeight: 700,
|
|
1489
|
+
lineHeight,
|
|
1490
|
+
marginTop: import_react_native8.Platform.OS === "ios" ? readyPaddingVertical : void 0,
|
|
1491
|
+
children: prefix
|
|
1492
|
+
}
|
|
1493
|
+
) : prefix
|
|
1494
|
+
}
|
|
1495
|
+
),
|
|
1496
|
+
isIOSDateTime ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1497
|
+
!iOSDateTimeFullSize ? labelComponent : void 0,
|
|
1498
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1499
|
+
import_datetimepicker.default,
|
|
1500
|
+
{
|
|
1501
|
+
value: internalDateValue ?? /* @__PURE__ */ new Date(),
|
|
1502
|
+
mode: type,
|
|
1503
|
+
display: iOSDateTimeFullSize ? type === "date" ? "inline" : "spinner" : "default",
|
|
1504
|
+
accentColor: theme2.colors.primary,
|
|
1505
|
+
style: rnDateTimePickerStyle,
|
|
1506
|
+
onChange: onChangeRNDateTimePicker
|
|
1507
|
+
}
|
|
1508
|
+
)
|
|
1509
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1510
|
+
View_default,
|
|
1298
1511
|
{
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1512
|
+
flex: 1,
|
|
1513
|
+
width: "100%",
|
|
1514
|
+
borderTopLeftRadius: prefix ? 0 : theme2.styles.borderRadius,
|
|
1515
|
+
borderBottomLeftRadius: prefix ? 0 : theme2.styles.borderRadius,
|
|
1516
|
+
borderTopRightRadius: suffix ? 0 : theme2.styles.borderRadius,
|
|
1517
|
+
borderBottomRightRadius: suffix ? 0 : theme2.styles.borderRadius,
|
|
1518
|
+
pressStrength: 1,
|
|
1519
|
+
onPress: import_react_native8.Platform.OS === "android" ? editable === false || withPressInputField ? onPressInputField : void 0 : void 0,
|
|
1520
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1521
|
+
Animate_default.View,
|
|
1522
|
+
{
|
|
1523
|
+
flex: 1,
|
|
1524
|
+
backgroundColor: theme2.colors.backgroundContent,
|
|
1525
|
+
borderTopLeftRadius: prefix ? 0 : theme2.styles.borderRadius,
|
|
1526
|
+
borderBottomLeftRadius: prefix ? 0 : theme2.styles.borderRadius,
|
|
1527
|
+
borderTopRightRadius: suffix ? 0 : theme2.styles.borderRadius,
|
|
1528
|
+
borderBottomRightRadius: suffix ? 0 : theme2.styles.borderRadius,
|
|
1529
|
+
borderWidth,
|
|
1530
|
+
initialBorderColor: theme2.colors.border,
|
|
1531
|
+
animateBorderColor: isFocused ? theme2.colors.primary : isError ? theme2.colors.error : theme2.colors.border,
|
|
1532
|
+
overflow: "hidden",
|
|
1533
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1534
|
+
import_react_native8.TextInput,
|
|
1535
|
+
{
|
|
1536
|
+
style: textInputStyle,
|
|
1537
|
+
value: internalValue,
|
|
1538
|
+
defaultValue,
|
|
1539
|
+
autoCapitalize,
|
|
1540
|
+
autoComplete,
|
|
1541
|
+
autoCorrect,
|
|
1542
|
+
autoFocus,
|
|
1543
|
+
placeholder: placeholder ?? label,
|
|
1544
|
+
placeholderTextColor: theme2.colors.textSecondary + "80",
|
|
1545
|
+
enterKeyHint: returnKeyLabel,
|
|
1546
|
+
returnKeyType,
|
|
1547
|
+
onSubmitEditing: onPressEnter,
|
|
1548
|
+
readOnly: !editable || disabled || type === "date" || type === "time",
|
|
1549
|
+
textAlign,
|
|
1550
|
+
editable: !disabled,
|
|
1551
|
+
keyboardAppearance,
|
|
1552
|
+
keyboardType,
|
|
1553
|
+
cursorColor: theme2.colors.primary,
|
|
1554
|
+
selectionColor: theme2.colors.primary,
|
|
1555
|
+
secureTextEntry,
|
|
1556
|
+
onFocus: onFocusElement,
|
|
1557
|
+
onBlur: onBlurElement,
|
|
1558
|
+
onChangeText,
|
|
1559
|
+
maxLength,
|
|
1560
|
+
multiline,
|
|
1561
|
+
numberOfLines,
|
|
1562
|
+
onPress: withPressInputField ? onPressInputField : void 0,
|
|
1563
|
+
ref: textInputRef
|
|
1564
|
+
}
|
|
1565
|
+
)
|
|
1566
|
+
}
|
|
1567
|
+
)
|
|
1568
|
+
}
|
|
1569
|
+
),
|
|
1570
|
+
suffix && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1571
|
+
View_default,
|
|
1572
|
+
{
|
|
1573
|
+
isRow: true,
|
|
1574
|
+
height: "100%",
|
|
1575
|
+
backgroundColor: prefixSuffixBackgroundColor,
|
|
1576
|
+
alignItems: "center",
|
|
1577
|
+
borderWidth,
|
|
1578
|
+
borderLeftWidth: 0,
|
|
1579
|
+
borderTopRightRadius: theme2.styles.borderRadius,
|
|
1580
|
+
borderBottomRightRadius: theme2.styles.borderRadius,
|
|
1581
|
+
borderColor: theme2.colors.border,
|
|
1582
|
+
paddingHorizontal: readyPaddingHorizontal,
|
|
1583
|
+
onPress: onPressSuffix,
|
|
1584
|
+
children: typeof suffix === "string" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1585
|
+
Text_default,
|
|
1586
|
+
{
|
|
1587
|
+
fontWeight: 700,
|
|
1588
|
+
lineHeight,
|
|
1589
|
+
marginTop: import_react_native8.Platform.OS === "ios" ? readyPaddingVertical : void 0,
|
|
1590
|
+
children: suffix
|
|
1591
|
+
}
|
|
1592
|
+
) : suffix
|
|
1323
1593
|
}
|
|
1324
1594
|
)
|
|
1325
|
-
}
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
children: infoMessage
|
|
1354
|
-
}
|
|
1355
|
-
),
|
|
1356
|
-
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1357
|
-
Animate_default.Text,
|
|
1358
|
-
{
|
|
1359
|
-
fontSize: 14,
|
|
1360
|
-
color: theme2.colors.error,
|
|
1361
|
-
initialHeight: 0,
|
|
1362
|
-
initialOpacity: 0,
|
|
1363
|
-
animateHeight: 17,
|
|
1364
|
-
animateOpacity: 1,
|
|
1365
|
-
children: errorMessage
|
|
1366
|
-
}
|
|
1367
|
-
)
|
|
1368
|
-
] });
|
|
1595
|
+
] }),
|
|
1596
|
+
infoMessage && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1597
|
+
Animate_default.Text,
|
|
1598
|
+
{
|
|
1599
|
+
fontSize: 14,
|
|
1600
|
+
color: theme2.colors.textSecondary,
|
|
1601
|
+
initialHeight: 0,
|
|
1602
|
+
initialOpacity: 0,
|
|
1603
|
+
animateHeight: 17,
|
|
1604
|
+
animateOpacity: 1,
|
|
1605
|
+
children: infoMessage
|
|
1606
|
+
}
|
|
1607
|
+
),
|
|
1608
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1609
|
+
Animate_default.Text,
|
|
1610
|
+
{
|
|
1611
|
+
fontSize: 14,
|
|
1612
|
+
color: theme2.colors.error,
|
|
1613
|
+
initialHeight: 0,
|
|
1614
|
+
initialOpacity: 0,
|
|
1615
|
+
animateHeight: 17,
|
|
1616
|
+
animateOpacity: 1,
|
|
1617
|
+
children: errorMessage
|
|
1618
|
+
}
|
|
1619
|
+
)
|
|
1620
|
+
]
|
|
1621
|
+
}
|
|
1622
|
+
);
|
|
1369
1623
|
}
|
|
1370
1624
|
);
|
|
1371
1625
|
InputFieldComponent.email = (0, import_react10.forwardRef)(function Email(props, ref) {
|
|
@@ -1472,6 +1726,7 @@ var asyncStoragePlugin = (options) => ({
|
|
|
1472
1726
|
formatPhoneNumber,
|
|
1473
1727
|
generateAsyncStorage,
|
|
1474
1728
|
generateRandomString,
|
|
1729
|
+
getFormErrorObject,
|
|
1475
1730
|
getPluralWord,
|
|
1476
1731
|
lightenColor,
|
|
1477
1732
|
loaderControls,
|
|
@@ -1481,6 +1736,7 @@ var asyncStoragePlugin = (options) => ({
|
|
|
1481
1736
|
useBooleanState,
|
|
1482
1737
|
useDebounceState,
|
|
1483
1738
|
useDevice,
|
|
1739
|
+
useForm,
|
|
1484
1740
|
useKeyboard,
|
|
1485
1741
|
useLoader,
|
|
1486
1742
|
useLoaderControls,
|