react-native-better-html 1.0.17 → 1.0.18
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 +35 -6
- package/dist/index.d.ts +35 -6
- package/dist/index.js +175 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +159 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -31,7 +31,7 @@ type BetterComponentsProviderProps = BetterProviderCommonProps & {
|
|
|
31
31
|
config?: BetterComponentsProviderConfig;
|
|
32
32
|
};
|
|
33
33
|
declare function BetterComponentsProvider({ config, ...props }: BetterComponentsProviderProps): react_jsx_runtime.JSX.Element;
|
|
34
|
-
declare const _default$
|
|
34
|
+
declare const _default$4: react.MemoExoticComponent<typeof BetterComponentsProvider>;
|
|
35
35
|
|
|
36
36
|
type ComponentStyle<Style extends ViewStyle = ViewStyle> = OmitProps<Style, "shadowOffset" | ComponentExcludeMarginProps | ComponentExcludePaddingProps> & {
|
|
37
37
|
shadowOffsetWidth?: number;
|
|
@@ -75,15 +75,16 @@ declare const View: typeof ViewComponent & {
|
|
|
75
75
|
box: typeof ViewComponent.box;
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
+
type IconNameIOS = React.ComponentProps<typeof SymbolView>["name"];
|
|
78
79
|
type IconProps = {
|
|
79
80
|
name: IconName | AnyOtherString;
|
|
80
|
-
nameIOS?:
|
|
81
|
+
nameIOS?: IconNameIOS;
|
|
81
82
|
/** @default 16 */
|
|
82
83
|
size?: number;
|
|
83
84
|
color?: string;
|
|
84
85
|
} & OmitProps<ViewProps, "width" | "height" | "pressType">;
|
|
85
86
|
declare function Icon({ name, nameIOS, size, color, ...props }: IconProps): react_jsx_runtime.JSX.Element;
|
|
86
|
-
declare const _default$
|
|
87
|
+
declare const _default$3: react.MemoExoticComponent<typeof Icon>;
|
|
87
88
|
|
|
88
89
|
type InputFieldProps = {
|
|
89
90
|
flex?: ViewStyle["flex"];
|
|
@@ -107,7 +108,6 @@ type InputFieldProps = {
|
|
|
107
108
|
autoCapitalize?: React.ComponentProps<typeof TextInput>["autoCapitalize"];
|
|
108
109
|
autoComplete?: React.ComponentProps<typeof TextInput>["autoComplete"];
|
|
109
110
|
autoCorrect?: React.ComponentProps<typeof TextInput>["autoCorrect"];
|
|
110
|
-
/** @default "default" */
|
|
111
111
|
keyboardAppearance?: React.ComponentProps<typeof TextInput>["keyboardAppearance"];
|
|
112
112
|
keyboardType?: React.ComponentProps<typeof TextInput>["keyboardType"];
|
|
113
113
|
/** @default false */
|
|
@@ -164,6 +164,16 @@ declare const InputField: typeof InputFieldComponent & {
|
|
|
164
164
|
code: typeof InputFieldComponent.code;
|
|
165
165
|
};
|
|
166
166
|
|
|
167
|
+
type SwitchProps = {
|
|
168
|
+
isEnabled?: boolean;
|
|
169
|
+
defaultIsEnabled?: boolean;
|
|
170
|
+
/** @default false */
|
|
171
|
+
disabled?: boolean;
|
|
172
|
+
onChange?: (isEnabled: boolean) => void;
|
|
173
|
+
};
|
|
174
|
+
declare function Switch({ isEnabled, defaultIsEnabled, disabled, onChange }: SwitchProps): react_jsx_runtime.JSX.Element;
|
|
175
|
+
declare const _default$2: react.MemoExoticComponent<typeof Switch>;
|
|
176
|
+
|
|
167
177
|
declare function useDevice(): {
|
|
168
178
|
safeArea: {
|
|
169
179
|
/** @description The safe area insets after calculations. Recommended to use this instead of the raw insets. */
|
|
@@ -207,6 +217,7 @@ declare function useForm<FormFields extends Record<string | number, FormFieldVal
|
|
|
207
217
|
setFieldValue: <FieldName extends keyof FormFields>(field: FieldName, value: FormFields[FieldName] | undefined) => void;
|
|
208
218
|
setFieldsValue: (values: Partial<FormFields>) => void;
|
|
209
219
|
getInputFieldProps: <FieldName extends keyof FormFields>(field: FieldName) => ComponentPropWithRef<InputFieldRef, InputFieldProps>;
|
|
220
|
+
getSwitchProps: <FieldName extends keyof FormFields>(field: FieldName, insideListItem?: boolean) => SwitchProps;
|
|
210
221
|
focusField: (field: keyof FormFields) => void;
|
|
211
222
|
inputFieldRefs: Record<keyof FormFields, TextInput | undefined>;
|
|
212
223
|
validate: () => {};
|
|
@@ -447,10 +458,28 @@ type StatusBarProps = {
|
|
|
447
458
|
iOSBarStyle?: React.ComponentProps<typeof StatusBar$1>["barStyle"];
|
|
448
459
|
};
|
|
449
460
|
declare function StatusBar({ darkStatusBar, hidden, barStyle, androidBarStyle, iOSBarStyle }: StatusBarProps): react_jsx_runtime.JSX.Element;
|
|
450
|
-
declare const _default: react.MemoExoticComponent<typeof StatusBar>;
|
|
461
|
+
declare const _default$1: react.MemoExoticComponent<typeof StatusBar>;
|
|
462
|
+
|
|
463
|
+
type ListItemProps = {
|
|
464
|
+
icon?: IconName | AnyOtherString;
|
|
465
|
+
iconIOS?: IconNameIOS;
|
|
466
|
+
title?: string;
|
|
467
|
+
description?: string;
|
|
468
|
+
rightElement?: "arrow" | "switch";
|
|
469
|
+
/** @default theme.colors.backgroundBase */
|
|
470
|
+
backgroundColor?: ViewProps["backgroundColor"];
|
|
471
|
+
/** @default false */
|
|
472
|
+
insideScreenHolder?: boolean;
|
|
473
|
+
onPress?: () => void;
|
|
474
|
+
rightArrowValue?: string | number;
|
|
475
|
+
switchIsEnabled?: boolean;
|
|
476
|
+
switchOnChange?: (isEnabled: boolean) => void;
|
|
477
|
+
};
|
|
478
|
+
declare function ListItem({ icon, iconIOS, title, description, rightElement, backgroundColor, insideScreenHolder, onPress, rightArrowValue, switchIsEnabled, switchOnChange, }: ListItemProps): react_jsx_runtime.JSX.Element;
|
|
479
|
+
declare const _default: react.MemoExoticComponent<typeof ListItem>;
|
|
451
480
|
|
|
452
481
|
type AsyncStoragePluginOptions = {};
|
|
453
482
|
declare const defaultAsyncStoragePluginOptions: Required<AsyncStoragePluginOptions>;
|
|
454
483
|
declare const asyncStoragePlugin: BetterComponentsPluginConstructor<AsyncStoragePluginOptions>;
|
|
455
484
|
|
|
456
|
-
export { Animate, type AnimateTextProps, type AnimateViewProps, type AppConfig, type AsyncStoragePluginOptions, type BetterComponentsConfig, type BetterComponentsPlugin, _default$
|
|
485
|
+
export { Animate, type AnimateTextProps, type AnimateViewProps, type AppConfig, type AsyncStoragePluginOptions, type BetterComponentsConfig, type BetterComponentsPlugin, _default$4 as BetterComponentsProvider, type BetterComponentsProviderConfig, Button, type ButtonProps, type ComponentMarginProps, type ComponentPaddingProps, type FooterProps, _default$3 as Icon, type IconNameIOS, type IconProps, Image, type ImageProps, InputField, type InputFieldProps, type InputFieldRef, _default as ListItem, type ListItemProps, Loader, type LoaderProps, type LoaderSize, type PluginName, ScreenHolder, type ScreenHolderProps, _default$1 as StatusBar, type StatusBarProps, _default$2 as Switch, type SwitchProps, Text, type TextProps, View, type ViewProps, asyncStoragePlugin, defaultAsyncStoragePluginOptions, generateAsyncStorage, getFormErrorObject, pressStrength, useBetterComponentsContext, useDevice, useEventEmitter, useForm, useKeyboard };
|
package/dist/index.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ type BetterComponentsProviderProps = BetterProviderCommonProps & {
|
|
|
31
31
|
config?: BetterComponentsProviderConfig;
|
|
32
32
|
};
|
|
33
33
|
declare function BetterComponentsProvider({ config, ...props }: BetterComponentsProviderProps): react_jsx_runtime.JSX.Element;
|
|
34
|
-
declare const _default$
|
|
34
|
+
declare const _default$4: react.MemoExoticComponent<typeof BetterComponentsProvider>;
|
|
35
35
|
|
|
36
36
|
type ComponentStyle<Style extends ViewStyle = ViewStyle> = OmitProps<Style, "shadowOffset" | ComponentExcludeMarginProps | ComponentExcludePaddingProps> & {
|
|
37
37
|
shadowOffsetWidth?: number;
|
|
@@ -75,15 +75,16 @@ declare const View: typeof ViewComponent & {
|
|
|
75
75
|
box: typeof ViewComponent.box;
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
+
type IconNameIOS = React.ComponentProps<typeof SymbolView>["name"];
|
|
78
79
|
type IconProps = {
|
|
79
80
|
name: IconName | AnyOtherString;
|
|
80
|
-
nameIOS?:
|
|
81
|
+
nameIOS?: IconNameIOS;
|
|
81
82
|
/** @default 16 */
|
|
82
83
|
size?: number;
|
|
83
84
|
color?: string;
|
|
84
85
|
} & OmitProps<ViewProps, "width" | "height" | "pressType">;
|
|
85
86
|
declare function Icon({ name, nameIOS, size, color, ...props }: IconProps): react_jsx_runtime.JSX.Element;
|
|
86
|
-
declare const _default$
|
|
87
|
+
declare const _default$3: react.MemoExoticComponent<typeof Icon>;
|
|
87
88
|
|
|
88
89
|
type InputFieldProps = {
|
|
89
90
|
flex?: ViewStyle["flex"];
|
|
@@ -107,7 +108,6 @@ type InputFieldProps = {
|
|
|
107
108
|
autoCapitalize?: React.ComponentProps<typeof TextInput>["autoCapitalize"];
|
|
108
109
|
autoComplete?: React.ComponentProps<typeof TextInput>["autoComplete"];
|
|
109
110
|
autoCorrect?: React.ComponentProps<typeof TextInput>["autoCorrect"];
|
|
110
|
-
/** @default "default" */
|
|
111
111
|
keyboardAppearance?: React.ComponentProps<typeof TextInput>["keyboardAppearance"];
|
|
112
112
|
keyboardType?: React.ComponentProps<typeof TextInput>["keyboardType"];
|
|
113
113
|
/** @default false */
|
|
@@ -164,6 +164,16 @@ declare const InputField: typeof InputFieldComponent & {
|
|
|
164
164
|
code: typeof InputFieldComponent.code;
|
|
165
165
|
};
|
|
166
166
|
|
|
167
|
+
type SwitchProps = {
|
|
168
|
+
isEnabled?: boolean;
|
|
169
|
+
defaultIsEnabled?: boolean;
|
|
170
|
+
/** @default false */
|
|
171
|
+
disabled?: boolean;
|
|
172
|
+
onChange?: (isEnabled: boolean) => void;
|
|
173
|
+
};
|
|
174
|
+
declare function Switch({ isEnabled, defaultIsEnabled, disabled, onChange }: SwitchProps): react_jsx_runtime.JSX.Element;
|
|
175
|
+
declare const _default$2: react.MemoExoticComponent<typeof Switch>;
|
|
176
|
+
|
|
167
177
|
declare function useDevice(): {
|
|
168
178
|
safeArea: {
|
|
169
179
|
/** @description The safe area insets after calculations. Recommended to use this instead of the raw insets. */
|
|
@@ -207,6 +217,7 @@ declare function useForm<FormFields extends Record<string | number, FormFieldVal
|
|
|
207
217
|
setFieldValue: <FieldName extends keyof FormFields>(field: FieldName, value: FormFields[FieldName] | undefined) => void;
|
|
208
218
|
setFieldsValue: (values: Partial<FormFields>) => void;
|
|
209
219
|
getInputFieldProps: <FieldName extends keyof FormFields>(field: FieldName) => ComponentPropWithRef<InputFieldRef, InputFieldProps>;
|
|
220
|
+
getSwitchProps: <FieldName extends keyof FormFields>(field: FieldName, insideListItem?: boolean) => SwitchProps;
|
|
210
221
|
focusField: (field: keyof FormFields) => void;
|
|
211
222
|
inputFieldRefs: Record<keyof FormFields, TextInput | undefined>;
|
|
212
223
|
validate: () => {};
|
|
@@ -447,10 +458,28 @@ type StatusBarProps = {
|
|
|
447
458
|
iOSBarStyle?: React.ComponentProps<typeof StatusBar$1>["barStyle"];
|
|
448
459
|
};
|
|
449
460
|
declare function StatusBar({ darkStatusBar, hidden, barStyle, androidBarStyle, iOSBarStyle }: StatusBarProps): react_jsx_runtime.JSX.Element;
|
|
450
|
-
declare const _default: react.MemoExoticComponent<typeof StatusBar>;
|
|
461
|
+
declare const _default$1: react.MemoExoticComponent<typeof StatusBar>;
|
|
462
|
+
|
|
463
|
+
type ListItemProps = {
|
|
464
|
+
icon?: IconName | AnyOtherString;
|
|
465
|
+
iconIOS?: IconNameIOS;
|
|
466
|
+
title?: string;
|
|
467
|
+
description?: string;
|
|
468
|
+
rightElement?: "arrow" | "switch";
|
|
469
|
+
/** @default theme.colors.backgroundBase */
|
|
470
|
+
backgroundColor?: ViewProps["backgroundColor"];
|
|
471
|
+
/** @default false */
|
|
472
|
+
insideScreenHolder?: boolean;
|
|
473
|
+
onPress?: () => void;
|
|
474
|
+
rightArrowValue?: string | number;
|
|
475
|
+
switchIsEnabled?: boolean;
|
|
476
|
+
switchOnChange?: (isEnabled: boolean) => void;
|
|
477
|
+
};
|
|
478
|
+
declare function ListItem({ icon, iconIOS, title, description, rightElement, backgroundColor, insideScreenHolder, onPress, rightArrowValue, switchIsEnabled, switchOnChange, }: ListItemProps): react_jsx_runtime.JSX.Element;
|
|
479
|
+
declare const _default: react.MemoExoticComponent<typeof ListItem>;
|
|
451
480
|
|
|
452
481
|
type AsyncStoragePluginOptions = {};
|
|
453
482
|
declare const defaultAsyncStoragePluginOptions: Required<AsyncStoragePluginOptions>;
|
|
454
483
|
declare const asyncStoragePlugin: BetterComponentsPluginConstructor<AsyncStoragePluginOptions>;
|
|
455
484
|
|
|
456
|
-
export { Animate, type AnimateTextProps, type AnimateViewProps, type AppConfig, type AsyncStoragePluginOptions, type BetterComponentsConfig, type BetterComponentsPlugin, _default$
|
|
485
|
+
export { Animate, type AnimateTextProps, type AnimateViewProps, type AppConfig, type AsyncStoragePluginOptions, type BetterComponentsConfig, type BetterComponentsPlugin, _default$4 as BetterComponentsProvider, type BetterComponentsProviderConfig, Button, type ButtonProps, type ComponentMarginProps, type ComponentPaddingProps, type FooterProps, _default$3 as Icon, type IconNameIOS, type IconProps, Image, type ImageProps, InputField, type InputFieldProps, type InputFieldRef, _default as ListItem, type ListItemProps, Loader, type LoaderProps, type LoaderSize, type PluginName, ScreenHolder, type ScreenHolderProps, _default$1 as StatusBar, type StatusBarProps, _default$2 as Switch, type SwitchProps, Text, type TextProps, View, type ViewProps, asyncStoragePlugin, defaultAsyncStoragePluginOptions, generateAsyncStorage, getFormErrorObject, pressStrength, useBetterComponentsContext, useDevice, useEventEmitter, useForm, useKeyboard };
|
package/dist/index.js
CHANGED
|
@@ -36,42 +36,44 @@ __export(index_exports, {
|
|
|
36
36
|
Icon: () => Icon_default,
|
|
37
37
|
Image: () => Image_default,
|
|
38
38
|
InputField: () => InputField_default,
|
|
39
|
+
ListItem: () => ListItem_default,
|
|
39
40
|
Loader: () => Loader_default,
|
|
40
41
|
ScreenHolder: () => ScreenHolder_default,
|
|
41
42
|
StatusBar: () => StatusBar_default,
|
|
43
|
+
Switch: () => Switch_default,
|
|
42
44
|
Text: () => Text_default,
|
|
43
45
|
View: () => View_default,
|
|
44
46
|
asyncStoragePlugin: () => asyncStoragePlugin,
|
|
45
|
-
colorThemeControls: () =>
|
|
46
|
-
countries: () =>
|
|
47
|
-
darkenColor: () =>
|
|
47
|
+
colorThemeControls: () => import_react_better_core14.colorThemeControls,
|
|
48
|
+
countries: () => import_react_better_core14.countries,
|
|
49
|
+
darkenColor: () => import_react_better_core14.darkenColor,
|
|
48
50
|
defaultAsyncStoragePluginOptions: () => defaultAsyncStoragePluginOptions,
|
|
49
|
-
desaturateColor: () =>
|
|
50
|
-
eventPreventDefault: () =>
|
|
51
|
-
eventPreventStop: () =>
|
|
52
|
-
eventStopPropagation: () =>
|
|
53
|
-
formatPhoneNumber: () =>
|
|
51
|
+
desaturateColor: () => import_react_better_core14.desaturateColor,
|
|
52
|
+
eventPreventDefault: () => import_react_better_core14.eventPreventDefault,
|
|
53
|
+
eventPreventStop: () => import_react_better_core14.eventPreventStop,
|
|
54
|
+
eventStopPropagation: () => import_react_better_core14.eventStopPropagation,
|
|
55
|
+
formatPhoneNumber: () => import_react_better_core14.formatPhoneNumber,
|
|
54
56
|
generateAsyncStorage: () => generateAsyncStorage,
|
|
55
|
-
generateRandomString: () =>
|
|
57
|
+
generateRandomString: () => import_react_better_core14.generateRandomString,
|
|
56
58
|
getFormErrorObject: () => getFormErrorObject,
|
|
57
|
-
getPluralWord: () =>
|
|
58
|
-
lightenColor: () =>
|
|
59
|
-
loaderControls: () =>
|
|
59
|
+
getPluralWord: () => import_react_better_core14.getPluralWord,
|
|
60
|
+
lightenColor: () => import_react_better_core14.lightenColor,
|
|
61
|
+
loaderControls: () => import_react_better_core14.loaderControls,
|
|
60
62
|
pressStrength: () => pressStrength,
|
|
61
|
-
saturateColor: () =>
|
|
63
|
+
saturateColor: () => import_react_better_core14.saturateColor,
|
|
62
64
|
useBetterComponentsContext: () => useBetterComponentsContext,
|
|
63
|
-
useBooleanState: () =>
|
|
64
|
-
useDebounceState: () =>
|
|
65
|
+
useBooleanState: () => import_react_better_core14.useBooleanState,
|
|
66
|
+
useDebounceState: () => import_react_better_core14.useDebounceState,
|
|
65
67
|
useDevice: () => useDevice,
|
|
66
68
|
useEventEmitter: () => useEventEmitter,
|
|
67
69
|
useForm: () => useForm,
|
|
68
70
|
useKeyboard: () => useKeyboard,
|
|
69
|
-
useLoader: () =>
|
|
70
|
-
useLoaderControls: () =>
|
|
71
|
-
useTheme: () =>
|
|
71
|
+
useLoader: () => import_react_better_core14.useLoader,
|
|
72
|
+
useLoaderControls: () => import_react_better_core14.useLoaderControls,
|
|
73
|
+
useTheme: () => import_react_better_core14.useTheme
|
|
72
74
|
});
|
|
73
75
|
module.exports = __toCommonJS(index_exports);
|
|
74
|
-
var
|
|
76
|
+
var import_react_better_core14 = require("react-better-core");
|
|
75
77
|
|
|
76
78
|
// src/components/BetterComponentsProvider.tsx
|
|
77
79
|
var import_react = require("react");
|
|
@@ -584,6 +586,22 @@ function useForm(options) {
|
|
|
584
586
|
},
|
|
585
587
|
[values, setFieldValue, errors, requiredFields, additional, onSubmitFunction]
|
|
586
588
|
);
|
|
589
|
+
const getSwitchProps = (0, import_react2.useCallback)(
|
|
590
|
+
(field, insideListItem) => {
|
|
591
|
+
return insideListItem ? {
|
|
592
|
+
switchIsEnabled: values[field],
|
|
593
|
+
switchOnChange: (value) => {
|
|
594
|
+
setFieldValue(field, value);
|
|
595
|
+
}
|
|
596
|
+
} : {
|
|
597
|
+
isEnabled: values[field],
|
|
598
|
+
onChange: (value) => {
|
|
599
|
+
setFieldValue(field, value);
|
|
600
|
+
}
|
|
601
|
+
};
|
|
602
|
+
},
|
|
603
|
+
[values, setFieldValue]
|
|
604
|
+
);
|
|
587
605
|
const reset = (0, import_react2.useCallback)(() => {
|
|
588
606
|
setValues(defaultValues);
|
|
589
607
|
setErrors({});
|
|
@@ -607,6 +625,7 @@ function useForm(options) {
|
|
|
607
625
|
setFieldValue,
|
|
608
626
|
setFieldsValue,
|
|
609
627
|
getInputFieldProps,
|
|
628
|
+
getSwitchProps,
|
|
610
629
|
focusField,
|
|
611
630
|
inputFieldRefs: inputFieldRefs.current,
|
|
612
631
|
validate: validateForm,
|
|
@@ -1428,7 +1447,7 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1428
1447
|
autoCapitalize,
|
|
1429
1448
|
autoComplete,
|
|
1430
1449
|
autoCorrect,
|
|
1431
|
-
keyboardAppearance
|
|
1450
|
+
keyboardAppearance,
|
|
1432
1451
|
keyboardType,
|
|
1433
1452
|
secureTextEntry,
|
|
1434
1453
|
returnKeyLabel,
|
|
@@ -1632,6 +1651,7 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1632
1651
|
mode: type,
|
|
1633
1652
|
display: iOSDateTimeFullSize ? type === "date" ? "inline" : "spinner" : "default",
|
|
1634
1653
|
accentColor: theme2.colors.primary,
|
|
1654
|
+
themeVariant: colorTheme === "dark" ? "dark" : "light",
|
|
1635
1655
|
style: rnDateTimePickerStyle,
|
|
1636
1656
|
onChange: onChangeRNDateTimePicker
|
|
1637
1657
|
}
|
|
@@ -1694,7 +1714,7 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1694
1714
|
readOnly: !editable || disabled || type === "date" || type === "time",
|
|
1695
1715
|
textAlign,
|
|
1696
1716
|
editable: !disabled,
|
|
1697
|
-
keyboardAppearance,
|
|
1717
|
+
keyboardAppearance: keyboardAppearance ?? colorTheme === "dark" ? "dark" : "light",
|
|
1698
1718
|
keyboardType,
|
|
1699
1719
|
cursorColor: theme2.colors.primary,
|
|
1700
1720
|
selectionColor: theme2.colors.primary,
|
|
@@ -1852,23 +1872,148 @@ InputField.search = InputFieldComponent.search;
|
|
|
1852
1872
|
InputField.code = InputFieldComponent.code;
|
|
1853
1873
|
var InputField_default = InputField;
|
|
1854
1874
|
|
|
1855
|
-
// src/components/
|
|
1875
|
+
// src/components/Switch.tsx
|
|
1856
1876
|
var import_react13 = require("react");
|
|
1857
|
-
var import_react_better_core11 = require("react-better-core");
|
|
1858
1877
|
var import_react_native10 = require("react-native");
|
|
1878
|
+
var import_react_better_core11 = require("react-better-core");
|
|
1859
1879
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1860
|
-
function
|
|
1880
|
+
function Switch({ isEnabled, defaultIsEnabled, disabled, onChange }) {
|
|
1861
1881
|
const theme2 = (0, import_react_better_core11.useTheme)();
|
|
1862
|
-
|
|
1863
|
-
|
|
1882
|
+
const [enabled, setEnabled] = (0, import_react_better_core11.useBooleanState)(isEnabled ?? defaultIsEnabled);
|
|
1883
|
+
const onPressElement = (0, import_react13.useCallback)(() => {
|
|
1884
|
+
onChange?.(!enabled);
|
|
1885
|
+
setEnabled.toggle();
|
|
1886
|
+
}, [onChange, enabled]);
|
|
1887
|
+
const trackColor = (0, import_react13.useMemo)(
|
|
1888
|
+
() => ({
|
|
1889
|
+
false: theme2.colors.border,
|
|
1890
|
+
true: theme2.colors.primary
|
|
1891
|
+
}),
|
|
1892
|
+
[theme2.colors]
|
|
1893
|
+
);
|
|
1894
|
+
(0, import_react13.useEffect)(() => {
|
|
1895
|
+
if (isEnabled === void 0) return;
|
|
1896
|
+
setEnabled.setState(isEnabled);
|
|
1897
|
+
}, [isEnabled]);
|
|
1898
|
+
const ballSize = 26;
|
|
1899
|
+
const ballGap = 3;
|
|
1900
|
+
const holderWidth = ballSize * 2.1;
|
|
1901
|
+
return import_react_native10.Platform.OS === "ios" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1902
|
+
import_react_native10.Switch,
|
|
1903
|
+
{
|
|
1904
|
+
trackColor,
|
|
1905
|
+
ios_backgroundColor: theme2.colors.border,
|
|
1906
|
+
onValueChange: onPressElement,
|
|
1907
|
+
value: enabled,
|
|
1908
|
+
disabled
|
|
1909
|
+
}
|
|
1910
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1911
|
+
View_default,
|
|
1912
|
+
{
|
|
1913
|
+
width: holderWidth,
|
|
1914
|
+
borderRadius: 999,
|
|
1915
|
+
pressStrength: pressStrength().p05,
|
|
1916
|
+
disabled,
|
|
1917
|
+
onPress: !disabled ? onPressElement : void 0,
|
|
1918
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1919
|
+
Animate_default.View,
|
|
1920
|
+
{
|
|
1921
|
+
width: "100%",
|
|
1922
|
+
height: ballGap + ballSize + ballGap,
|
|
1923
|
+
borderRadius: 999,
|
|
1924
|
+
initialOpacity: 1,
|
|
1925
|
+
animateOpacity: disabled ? 0.6 : 1,
|
|
1926
|
+
initialBackgroundColor: theme2.colors.border,
|
|
1927
|
+
animateBackgroundColor: enabled ? theme2.colors.primary : theme2.colors.border,
|
|
1928
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1929
|
+
Animate_default.View,
|
|
1930
|
+
{
|
|
1931
|
+
width: ballSize,
|
|
1932
|
+
height: ballSize,
|
|
1933
|
+
top: ballGap,
|
|
1934
|
+
borderRadius: 999,
|
|
1935
|
+
backgroundColor: theme2.colors.backgroundContent,
|
|
1936
|
+
initialX: ballGap,
|
|
1937
|
+
animateX: enabled ? holderWidth - ballGap - ballSize : ballGap
|
|
1938
|
+
}
|
|
1939
|
+
)
|
|
1940
|
+
}
|
|
1941
|
+
)
|
|
1942
|
+
}
|
|
1943
|
+
);
|
|
1944
|
+
}
|
|
1945
|
+
var Switch_default = (0, import_react13.memo)(Switch);
|
|
1946
|
+
|
|
1947
|
+
// src/components/StatusBar.tsx
|
|
1948
|
+
var import_react14 = require("react");
|
|
1949
|
+
var import_react_better_core12 = require("react-better-core");
|
|
1950
|
+
var import_react_native11 = require("react-native");
|
|
1951
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1952
|
+
function StatusBar({ darkStatusBar, hidden, barStyle, androidBarStyle, iOSBarStyle }) {
|
|
1953
|
+
const theme2 = (0, import_react_better_core12.useTheme)();
|
|
1954
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1955
|
+
import_react_native11.StatusBar,
|
|
1864
1956
|
{
|
|
1865
1957
|
backgroundColor: darkStatusBar ? theme2.colors.backgroundSecondary : void 0,
|
|
1866
|
-
barStyle: barStyle ?? (
|
|
1958
|
+
barStyle: barStyle ?? (import_react_native11.Platform.OS === "android" ? androidBarStyle : iOSBarStyle),
|
|
1867
1959
|
hidden
|
|
1868
1960
|
}
|
|
1869
1961
|
);
|
|
1870
1962
|
}
|
|
1871
|
-
var StatusBar_default = (0,
|
|
1963
|
+
var StatusBar_default = (0, import_react14.memo)(StatusBar);
|
|
1964
|
+
|
|
1965
|
+
// src/components/ListItem.tsx
|
|
1966
|
+
var import_react15 = require("react");
|
|
1967
|
+
var import_react_better_core13 = require("react-better-core");
|
|
1968
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1969
|
+
function ListItem({
|
|
1970
|
+
icon,
|
|
1971
|
+
iconIOS,
|
|
1972
|
+
title,
|
|
1973
|
+
description,
|
|
1974
|
+
rightElement,
|
|
1975
|
+
backgroundColor,
|
|
1976
|
+
insideScreenHolder,
|
|
1977
|
+
onPress,
|
|
1978
|
+
rightArrowValue,
|
|
1979
|
+
switchIsEnabled,
|
|
1980
|
+
switchOnChange
|
|
1981
|
+
}) {
|
|
1982
|
+
const theme2 = (0, import_react_better_core13.useTheme)();
|
|
1983
|
+
const device = useDevice();
|
|
1984
|
+
const sideSpace = theme2.styles.space;
|
|
1985
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1986
|
+
View_default,
|
|
1987
|
+
{
|
|
1988
|
+
width: insideScreenHolder ? device.windowDimensions.width : "100%",
|
|
1989
|
+
backgroundColor: backgroundColor ?? theme2.colors.backgroundBase,
|
|
1990
|
+
marginHorizontal: insideScreenHolder ? -sideSpace : void 0,
|
|
1991
|
+
paddingVertical: theme2.styles.gap,
|
|
1992
|
+
paddingHorizontal: sideSpace,
|
|
1993
|
+
pressStrength: pressStrength().p05,
|
|
1994
|
+
onPress,
|
|
1995
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(View_default, { isRow: true, alignItems: "center", gap: theme2.styles.space, children: [
|
|
1996
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon_default, { name: icon, nameIOS: iconIOS, size: 22, color: theme2.colors.primary }),
|
|
1997
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(View_default, { flex: 1, flexDirection: "row", alignItems: "center", gap: theme2.styles.gap, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(View_default, { flex: 1, children: [
|
|
1998
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Text_default, { fontSize: 20, fontWeight: 700, children: title }),
|
|
1999
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Text_default.body, { children: description })
|
|
2000
|
+
] }) }),
|
|
2001
|
+
rightElement ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: rightElement === "arrow" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(View_default, { isRow: true, alignItems: "center", gap: theme2.styles.gap / 2, children: [
|
|
2002
|
+
rightArrowValue !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Text_default, { fontSize: 14, fontWeight: 700, children: rightArrowValue }),
|
|
2003
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2004
|
+
Icon_default,
|
|
2005
|
+
{
|
|
2006
|
+
name: "chevronRight",
|
|
2007
|
+
nameIOS: "chevron.right",
|
|
2008
|
+
color: rightArrowValue !== void 0 ? theme2.colors.textPrimary : theme2.colors.textSecondary
|
|
2009
|
+
}
|
|
2010
|
+
)
|
|
2011
|
+
] }) : rightElement === "switch" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Switch_default, { isEnabled: switchIsEnabled, onChange: switchOnChange }) : void 0 }) : void 0
|
|
2012
|
+
] })
|
|
2013
|
+
}
|
|
2014
|
+
);
|
|
2015
|
+
}
|
|
2016
|
+
var ListItem_default = (0, import_react15.memo)(ListItem);
|
|
1872
2017
|
|
|
1873
2018
|
// src/plugins/asyncStorage.ts
|
|
1874
2019
|
var defaultAsyncStoragePluginOptions = {};
|
|
@@ -1890,9 +2035,11 @@ var asyncStoragePlugin = (options) => ({
|
|
|
1890
2035
|
Icon,
|
|
1891
2036
|
Image,
|
|
1892
2037
|
InputField,
|
|
2038
|
+
ListItem,
|
|
1893
2039
|
Loader,
|
|
1894
2040
|
ScreenHolder,
|
|
1895
2041
|
StatusBar,
|
|
2042
|
+
Switch,
|
|
1896
2043
|
Text,
|
|
1897
2044
|
View,
|
|
1898
2045
|
asyncStoragePlugin,
|