react-native-better-html 1.0.16 → 1.0.17
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 +12 -4
- package/dist/index.d.ts +12 -4
- package/dist/index.js +96 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +101 -29
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -36,6 +36,26 @@ var theme = {};
|
|
|
36
36
|
|
|
37
37
|
// src/constants/icons.ts
|
|
38
38
|
var icons = {
|
|
39
|
+
eye: {
|
|
40
|
+
width: 576,
|
|
41
|
+
height: 512,
|
|
42
|
+
paths: [
|
|
43
|
+
{
|
|
44
|
+
d: "M288 32c-80.8 0-145.5 36.8-192.6 80.6C48.6 156 17.3 208 2.5 243.7c-3.3 7.9-3.3 16.7 0 24.6C17.3 304 48.6 356 95.4 399.4C142.5 443.2 207.2 480 288 480s145.5-36.8 192.6-80.6c46.8-43.5 78.1-95.4 93-131.1c3.3-7.9 3.3-16.7 0-24.6c-14.9-35.7-46.2-87.7-93-131.1C433.5 68.8 368.8 32 288 32zM144 256a144 144 0 1 1 288 0 144 144 0 1 1 -288 0zm144-64c0 35.3-28.7 64-64 64c-7.1 0-13.9-1.2-20.3-3.3c-5.5-1.8-11.9 1.6-11.7 7.4c.3 6.9 1.3 13.8 3.2 20.7c13.7 51.2 66.4 81.6 117.6 67.9s81.6-66.4 67.9-117.6c-11.1-41.5-47.8-69.4-88.6-71.1c-5.8-.2-9.2 6.1-7.4 11.7c2.1 6.4 3.3 13.2 3.3 20.3z",
|
|
45
|
+
type: "fill"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
eyeDashed: {
|
|
50
|
+
width: 640,
|
|
51
|
+
height: 512,
|
|
52
|
+
paths: [
|
|
53
|
+
{
|
|
54
|
+
d: "M38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2S-1.2 34.7 9.2 42.9l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7L525.6 386.7c39.6-40.6 66.4-86.1 79.9-118.4c3.3-7.9 3.3-16.7 0-24.6c-14.9-35.7-46.2-87.7-93-131.1C465.5 68.8 400.8 32 320 32c-68.2 0-125 26.3-169.3 60.8L38.8 5.1zM223.1 149.5C248.6 126.2 282.7 112 320 112c79.5 0 144 64.5 144 144c0 24.9-6.3 48.3-17.4 68.7L408 294.5c8.4-19.3 10.6-41.4 4.8-63.3c-11.1-41.5-47.8-69.4-88.6-71.1c-5.8-.2-9.2 6.1-7.4 11.7c2.1 6.4 3.3 13.2 3.3 20.3c0 10.2-2.4 19.8-6.6 28.3l-90.3-70.8zM373 389.9c-16.4 6.5-34.3 10.1-53 10.1c-79.5 0-144-64.5-144-144c0-6.9 .5-13.6 1.4-20.2L83.1 161.5C60.3 191.2 44 220.8 34.5 243.7c-3.3 7.9-3.3 16.7 0 24.6c14.9 35.7 46.2 87.7 93 131.1C174.5 443.2 239.2 480 320 480c47.8 0 89.9-12.9 126.2-32.5L373 389.9z",
|
|
55
|
+
type: "fill"
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
},
|
|
39
59
|
magnifyingGlass: {
|
|
40
60
|
width: 512,
|
|
41
61
|
height: 512,
|
|
@@ -157,7 +177,7 @@ var pressStrength = () => {
|
|
|
157
177
|
|
|
158
178
|
// src/utils/hooks.ts
|
|
159
179
|
import { useCallback, useEffect as useEffect2, useMemo as useMemo2, useRef, useState } from "react";
|
|
160
|
-
import { Dimensions, Keyboard } from "react-native";
|
|
180
|
+
import { DeviceEventEmitter, Dimensions, Keyboard } from "react-native";
|
|
161
181
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
162
182
|
import { useBooleanState as useBooleanState2, useTheme } from "react-better-core";
|
|
163
183
|
|
|
@@ -549,6 +569,17 @@ function useForm(options) {
|
|
|
549
569
|
canSubmit
|
|
550
570
|
};
|
|
551
571
|
}
|
|
572
|
+
function useEventEmitter() {
|
|
573
|
+
return {
|
|
574
|
+
emit: (eventName, params) => {
|
|
575
|
+
DeviceEventEmitter.emit(eventName, params);
|
|
576
|
+
},
|
|
577
|
+
listen: (eventName, callback = () => {
|
|
578
|
+
}) => {
|
|
579
|
+
return DeviceEventEmitter.addListener(eventName, callback);
|
|
580
|
+
}
|
|
581
|
+
};
|
|
582
|
+
}
|
|
552
583
|
|
|
553
584
|
// src/utils/functions.ts
|
|
554
585
|
var getFormErrorObject = (formValues) => {
|
|
@@ -1241,7 +1272,13 @@ var ImageComponent = function Image({ name, source, withDevFittingMode, ...props
|
|
|
1241
1272
|
}, [assets2, name]);
|
|
1242
1273
|
return /* @__PURE__ */ jsx8(NativeImage, { source: name ? assets2[name.toString()] : source, style, ...props });
|
|
1243
1274
|
};
|
|
1244
|
-
ImageComponent.profileImage = function ProfileImage({
|
|
1275
|
+
ImageComponent.profileImage = function ProfileImage({
|
|
1276
|
+
size = 50,
|
|
1277
|
+
letters,
|
|
1278
|
+
color,
|
|
1279
|
+
backgroundColor,
|
|
1280
|
+
...props
|
|
1281
|
+
}) {
|
|
1245
1282
|
const theme2 = useTheme7();
|
|
1246
1283
|
return letters ? /* @__PURE__ */ jsx8(
|
|
1247
1284
|
View_default,
|
|
@@ -1255,7 +1292,7 @@ ImageComponent.profileImage = function ProfileImage({ size = 50, letters, backgr
|
|
|
1255
1292
|
alignItems: "center",
|
|
1256
1293
|
justifyContent: "center",
|
|
1257
1294
|
...props,
|
|
1258
|
-
children: /* @__PURE__ */ jsx8(Text_default, { fontSize: size / 2.5, fontWeight: 700, marginTop: 1, children: letters.toUpperCase().slice(0, 2) })
|
|
1295
|
+
children: /* @__PURE__ */ jsx8(Text_default, { fontSize: size / 2.5, fontWeight: 700, color: color ?? theme2.colors.textPrimary, marginTop: 1, children: letters.toUpperCase().slice(0, 2) })
|
|
1259
1296
|
}
|
|
1260
1297
|
) : /* @__PURE__ */ jsx8(
|
|
1261
1298
|
ImageComponent,
|
|
@@ -1275,7 +1312,7 @@ Image2.profileImage = ImageComponent.profileImage;
|
|
|
1275
1312
|
var Image_default = Image2;
|
|
1276
1313
|
|
|
1277
1314
|
// src/components/Icon.tsx
|
|
1278
|
-
import { useEffect as useEffect4 } from "react";
|
|
1315
|
+
import { memo as memo9, useEffect as useEffect4 } from "react";
|
|
1279
1316
|
import { Platform as Platform4 } from "react-native";
|
|
1280
1317
|
import { Path, Svg } from "react-native-svg";
|
|
1281
1318
|
import { useBetterCoreContext as useBetterCoreContext3, useTheme as useTheme8 } from "react-better-core";
|
|
@@ -1292,31 +1329,43 @@ function Icon({ name, nameIOS, size = 16, color, ...props }) {
|
|
|
1292
1329
|
`The icon \`${name}\` you are trying to use does not exist. Make sure to add it to the \`icons\` object in \`<BetterComponentsProvider>\` config value prop.`
|
|
1293
1330
|
);
|
|
1294
1331
|
}, [icons2, name]);
|
|
1295
|
-
return /* @__PURE__ */ jsx9(
|
|
1296
|
-
|
|
1332
|
+
return /* @__PURE__ */ jsx9(
|
|
1333
|
+
View_default,
|
|
1297
1334
|
{
|
|
1298
|
-
width: size,
|
|
1299
|
-
height: size,
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1335
|
+
width: size + (parseFloat(props.padding?.toString() ?? "0") ?? 0) + (parseFloat(props.paddingHorizontal?.toString() ?? "0") ?? 0),
|
|
1336
|
+
height: size + (parseFloat(props.padding?.toString() ?? "0") ?? 0) + (parseFloat(props.paddingVertical?.toString() ?? "0") ?? 0),
|
|
1337
|
+
alignItems: "center",
|
|
1338
|
+
justifyContent: "center",
|
|
1339
|
+
pressType: "opacity",
|
|
1340
|
+
pressStrength: pressStrength().p2,
|
|
1341
|
+
...props,
|
|
1342
|
+
children: Platform4.OS === "ios" && nameIOS ? /* @__PURE__ */ jsx9(SymbolView, { name: nameIOS, tintColor: svgColor, size }) : /* @__PURE__ */ jsx9(
|
|
1343
|
+
Svg,
|
|
1304
1344
|
{
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1345
|
+
width: size,
|
|
1346
|
+
height: size,
|
|
1347
|
+
viewBox: `0 0 ${icons2[name.toString()]?.width ?? 0} ${icons2[name.toString()]?.height ?? 0}`,
|
|
1348
|
+
fill: "none",
|
|
1349
|
+
children: icons2[name.toString()]?.paths.map(({ type, ...path }) => /* @__PURE__ */ createElement(
|
|
1350
|
+
Path,
|
|
1351
|
+
{
|
|
1352
|
+
...path,
|
|
1353
|
+
fill: type === "fill" ? svgColor : void 0,
|
|
1354
|
+
stroke: type === "stroke" ? svgColor : void 0,
|
|
1355
|
+
key: path.d
|
|
1356
|
+
}
|
|
1357
|
+
))
|
|
1309
1358
|
}
|
|
1310
|
-
)
|
|
1359
|
+
)
|
|
1311
1360
|
}
|
|
1312
|
-
)
|
|
1361
|
+
);
|
|
1313
1362
|
}
|
|
1314
|
-
var Icon_default = Icon;
|
|
1363
|
+
var Icon_default = memo9(Icon);
|
|
1315
1364
|
|
|
1316
1365
|
// src/components/InputField.tsx
|
|
1317
1366
|
import {
|
|
1318
1367
|
forwardRef,
|
|
1319
|
-
memo as
|
|
1368
|
+
memo as memo10,
|
|
1320
1369
|
useCallback as useCallback3,
|
|
1321
1370
|
useEffect as useEffect5,
|
|
1322
1371
|
useImperativeHandle,
|
|
@@ -1375,8 +1424,10 @@ var InputFieldComponent = forwardRef(
|
|
|
1375
1424
|
numberOfLines = 2,
|
|
1376
1425
|
leftIcon,
|
|
1377
1426
|
leftIconIOS,
|
|
1427
|
+
onPressLeftIcon,
|
|
1378
1428
|
rightIcon,
|
|
1379
1429
|
rightIconIOS,
|
|
1430
|
+
onPressRightIcon,
|
|
1380
1431
|
paddingHorizontal,
|
|
1381
1432
|
paddingVertical,
|
|
1382
1433
|
onFocus,
|
|
@@ -1396,6 +1447,7 @@ var InputFieldComponent = forwardRef(
|
|
|
1396
1447
|
const [isFocused, setIsFocused] = useBooleanState4();
|
|
1397
1448
|
const isIOSDateTime = Platform5.OS === "ios" && (type === "date" || type === "time");
|
|
1398
1449
|
const iconSize = 16;
|
|
1450
|
+
const iconPadding = onPressRightIcon ? theme2.styles.gap : 0;
|
|
1399
1451
|
const iconSideSpace = theme2.styles.space;
|
|
1400
1452
|
const borderWidth = 1;
|
|
1401
1453
|
const readyPaddingHorizontal = paddingHorizontal ?? theme2.styles.space;
|
|
@@ -1594,11 +1646,13 @@ var InputFieldComponent = forwardRef(
|
|
|
1594
1646
|
Icon_default,
|
|
1595
1647
|
{
|
|
1596
1648
|
position: "absolute",
|
|
1597
|
-
left: iconSideSpace,
|
|
1649
|
+
left: iconSideSpace - iconPadding,
|
|
1598
1650
|
name: leftIcon,
|
|
1599
1651
|
nameIOS: leftIconIOS,
|
|
1600
1652
|
size: iconSize,
|
|
1601
|
-
pointerEvents: "box-none"
|
|
1653
|
+
pointerEvents: !onPressLeftIcon ? "box-none" : void 0,
|
|
1654
|
+
padding: iconPadding,
|
|
1655
|
+
onPress: onPressLeftIcon
|
|
1602
1656
|
}
|
|
1603
1657
|
),
|
|
1604
1658
|
/* @__PURE__ */ jsx10(
|
|
@@ -1638,11 +1692,13 @@ var InputFieldComponent = forwardRef(
|
|
|
1638
1692
|
Icon_default,
|
|
1639
1693
|
{
|
|
1640
1694
|
position: "absolute",
|
|
1641
|
-
right: iconSideSpace,
|
|
1695
|
+
right: iconSideSpace - iconPadding,
|
|
1642
1696
|
name: rightIcon,
|
|
1643
1697
|
nameIOS: rightIconIOS,
|
|
1644
1698
|
size: iconSize,
|
|
1645
|
-
pointerEvents: "box-none"
|
|
1699
|
+
pointerEvents: !onPressRightIcon ? "box-none" : void 0,
|
|
1700
|
+
padding: iconPadding,
|
|
1701
|
+
onPress: onPressRightIcon
|
|
1646
1702
|
}
|
|
1647
1703
|
)
|
|
1648
1704
|
]
|
|
@@ -1720,16 +1776,31 @@ InputFieldComponent.email = forwardRef(function Email(props, ref) {
|
|
|
1720
1776
|
);
|
|
1721
1777
|
});
|
|
1722
1778
|
InputFieldComponent.password = forwardRef(function Password(props, ref) {
|
|
1779
|
+
const inputFieldRef = useRef2(null);
|
|
1780
|
+
const [showPassword, setShowPassword] = useBooleanState4();
|
|
1781
|
+
const onPressEye = useCallback3(() => {
|
|
1782
|
+
setShowPassword.toggle();
|
|
1783
|
+
inputFieldRef.current?.focus();
|
|
1784
|
+
}, []);
|
|
1785
|
+
useImperativeHandle(
|
|
1786
|
+
ref,
|
|
1787
|
+
() => {
|
|
1788
|
+
return inputFieldRef.current;
|
|
1789
|
+
},
|
|
1790
|
+
[]
|
|
1791
|
+
);
|
|
1723
1792
|
return /* @__PURE__ */ jsx10(
|
|
1724
1793
|
InputFieldComponent,
|
|
1725
1794
|
{
|
|
1726
|
-
secureTextEntry:
|
|
1795
|
+
secureTextEntry: !showPassword,
|
|
1727
1796
|
placeholder: "******",
|
|
1728
1797
|
autoCapitalize: "none",
|
|
1729
1798
|
autoComplete: "password",
|
|
1730
1799
|
autoCorrect: false,
|
|
1800
|
+
rightIcon: showPassword ? "eyeDashed" : "eye",
|
|
1801
|
+
onPressRightIcon: onPressEye,
|
|
1731
1802
|
...props,
|
|
1732
|
-
ref
|
|
1803
|
+
ref: inputFieldRef
|
|
1733
1804
|
}
|
|
1734
1805
|
);
|
|
1735
1806
|
});
|
|
@@ -1753,7 +1824,7 @@ InputFieldComponent.code = forwardRef(function Password2({ isSmall, ...props },
|
|
|
1753
1824
|
}
|
|
1754
1825
|
);
|
|
1755
1826
|
});
|
|
1756
|
-
var InputField =
|
|
1827
|
+
var InputField = memo10(InputFieldComponent);
|
|
1757
1828
|
InputField.email = InputFieldComponent.email;
|
|
1758
1829
|
InputField.password = InputFieldComponent.password;
|
|
1759
1830
|
InputField.search = InputFieldComponent.search;
|
|
@@ -1761,7 +1832,7 @@ InputField.code = InputFieldComponent.code;
|
|
|
1761
1832
|
var InputField_default = InputField;
|
|
1762
1833
|
|
|
1763
1834
|
// src/components/StatusBar.tsx
|
|
1764
|
-
import { memo as
|
|
1835
|
+
import { memo as memo11 } from "react";
|
|
1765
1836
|
import { useTheme as useTheme10 } from "react-better-core";
|
|
1766
1837
|
import { StatusBar as NativeStatusBar, Platform as Platform6 } from "react-native";
|
|
1767
1838
|
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
@@ -1776,7 +1847,7 @@ function StatusBar({ darkStatusBar, hidden, barStyle, androidBarStyle, iOSBarSty
|
|
|
1776
1847
|
}
|
|
1777
1848
|
);
|
|
1778
1849
|
}
|
|
1779
|
-
var StatusBar_default =
|
|
1850
|
+
var StatusBar_default = memo11(StatusBar);
|
|
1780
1851
|
|
|
1781
1852
|
// src/plugins/asyncStorage.ts
|
|
1782
1853
|
var defaultAsyncStoragePluginOptions = {};
|
|
@@ -1824,6 +1895,7 @@ export {
|
|
|
1824
1895
|
useBooleanState5 as useBooleanState,
|
|
1825
1896
|
useDebounceState,
|
|
1826
1897
|
useDevice,
|
|
1898
|
+
useEventEmitter,
|
|
1827
1899
|
useForm,
|
|
1828
1900
|
useKeyboard,
|
|
1829
1901
|
useLoader2 as useLoader,
|