react-native-better-html 1.0.3 → 1.0.5
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 +67 -2
- package/dist/index.d.ts +67 -2
- package/dist/index.js +323 -32
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +323 -27
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -3,7 +3,7 @@ export { AnyOtherString, AssetName, AssetsConfig, Color, ColorName, ColorTheme,
|
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import * as react_native from 'react-native';
|
|
6
|
-
import { ViewStyle, GestureResponderEvent, ViewProps as ViewProps$1, TextProps as TextProps$1, TextStyle, ColorValue } from 'react-native';
|
|
6
|
+
import { ViewStyle, GestureResponderEvent, ViewProps as ViewProps$1, TextProps as TextProps$1, TextStyle, ColorValue, ImageSourcePropType, ImageProps as ImageProps$1, ImageStyle, TextInput, FocusEvent } from 'react-native';
|
|
7
7
|
import { EaseFunction, PropsTransforms } from '@legendapp/motion';
|
|
8
8
|
|
|
9
9
|
type AppConfig = {};
|
|
@@ -40,6 +40,9 @@ type ComponentMarginProps = Pick<ComponentStyle, "margin" | "marginTop" | "margi
|
|
|
40
40
|
type ComponentExcludeMarginProps = "marginBlock" | "marginBlockStart" | "marginBlockEnd" | "marginInline" | "marginInlineStart" | "marginInlineEnd" | "marginStart" | "marginEnd";
|
|
41
41
|
type ComponentPaddingProps = Pick<ComponentStyle, "padding" | "paddingTop" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingVertical" | "paddingHorizontal">;
|
|
42
42
|
type ComponentExcludePaddingProps = "paddingBlock" | "paddingBlockStart" | "paddingBlockEnd" | "paddingInline" | "paddingInlineStart" | "paddingInlineEnd" | "paddingStart" | "paddingEnd";
|
|
43
|
+
type ComponentPropWithRef<ComponentRef, ComponentProps> = ComponentProps & {
|
|
44
|
+
ref?: React.Ref<ComponentRef>;
|
|
45
|
+
};
|
|
43
46
|
|
|
44
47
|
declare const pressStrength: () => Record<"z05" | "z1" | "z2" | "z3", number>;
|
|
45
48
|
|
|
@@ -64,6 +67,11 @@ declare function useDevice(): {
|
|
|
64
67
|
/** @description Whether the device is small. */
|
|
65
68
|
isSmallDevice: boolean;
|
|
66
69
|
};
|
|
70
|
+
declare function useKeyboard(): {
|
|
71
|
+
isOpened: boolean;
|
|
72
|
+
willOpen: boolean;
|
|
73
|
+
height: number;
|
|
74
|
+
};
|
|
67
75
|
|
|
68
76
|
declare function generateAsyncStorage<AsyncStorage extends object>(): {
|
|
69
77
|
setItem: <StorageName extends keyof AsyncStorage>(name: StorageName, value: AsyncStorage[StorageName]) => void;
|
|
@@ -258,6 +266,8 @@ type ScreenHolderProps = {
|
|
|
258
266
|
/** @default 0 */
|
|
259
267
|
bottomSpace?: number;
|
|
260
268
|
footer?: React.ReactNode;
|
|
269
|
+
/** @default false */
|
|
270
|
+
keepFooterOnKeyboardOpened?: boolean;
|
|
261
271
|
children?: React.ReactNode;
|
|
262
272
|
};
|
|
263
273
|
type ScreenHolderComponentType = {
|
|
@@ -278,8 +288,63 @@ declare const ScreenHolder: typeof ScreenHolderComponent & {
|
|
|
278
288
|
footer: typeof ScreenHolderComponent.footer;
|
|
279
289
|
};
|
|
280
290
|
|
|
291
|
+
type ImageProps = {
|
|
292
|
+
name?: AssetName | AnyOtherString;
|
|
293
|
+
source?: ImageSourcePropType;
|
|
294
|
+
/** @default false */
|
|
295
|
+
withDevFittingMode?: boolean;
|
|
296
|
+
} & OmitProps<ImageProps$1, "source"> & ComponentStyle<ImageStyle>;
|
|
297
|
+
type ImageComponentType = {
|
|
298
|
+
(props: ImageProps): React.ReactElement;
|
|
299
|
+
profileImage: (props: OmitProps<ImageProps, "width" | "height"> & {
|
|
300
|
+
/** @default 50 */
|
|
301
|
+
size?: number;
|
|
302
|
+
letters?: string;
|
|
303
|
+
backgroundColor?: string;
|
|
304
|
+
}) => React.ReactElement;
|
|
305
|
+
};
|
|
306
|
+
declare const ImageComponent: ImageComponentType;
|
|
307
|
+
/** @description size is set to 100x100 by default */
|
|
308
|
+
declare const Image: typeof ImageComponent & {
|
|
309
|
+
profileImage: typeof ImageComponent.profileImage;
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
type InputFieldProps = {
|
|
313
|
+
placeholder?: string;
|
|
314
|
+
prefix?: string;
|
|
315
|
+
suffix?: string;
|
|
316
|
+
defaultValue?: string;
|
|
317
|
+
value?: string | number;
|
|
318
|
+
/** @default true */
|
|
319
|
+
editable?: boolean;
|
|
320
|
+
/** @default false */
|
|
321
|
+
autoFocus?: boolean;
|
|
322
|
+
autoCapitalize?: React.ComponentProps<typeof TextInput>["autoCapitalize"];
|
|
323
|
+
autoComplete?: React.ComponentProps<typeof TextInput>["autoComplete"];
|
|
324
|
+
autoCorrect?: React.ComponentProps<typeof TextInput>["autoCorrect"];
|
|
325
|
+
/** @default "default" */
|
|
326
|
+
keyboardAppearance?: React.ComponentProps<typeof TextInput>["keyboardAppearance"];
|
|
327
|
+
keyboardType?: React.ComponentProps<typeof TextInput>["keyboardType"];
|
|
328
|
+
/** @default false */
|
|
329
|
+
secureTextEntry?: boolean;
|
|
330
|
+
onFocus?: (event: FocusEvent) => void;
|
|
331
|
+
onBlur?: (event: FocusEvent) => void;
|
|
332
|
+
onChange?: (text: string) => void;
|
|
333
|
+
};
|
|
334
|
+
type InputFieldRef = {};
|
|
335
|
+
type InputFieldComponentType = {
|
|
336
|
+
(props: ComponentPropWithRef<InputFieldRef, InputFieldProps>): React.ReactElement;
|
|
337
|
+
email: (props: ComponentPropWithRef<InputFieldRef, InputFieldProps>) => React.ReactElement;
|
|
338
|
+
password: (props: ComponentPropWithRef<InputFieldRef, InputFieldProps>) => React.ReactElement;
|
|
339
|
+
};
|
|
340
|
+
declare const InputFieldComponent: InputFieldComponentType;
|
|
341
|
+
declare const InputField: typeof InputFieldComponent & {
|
|
342
|
+
email: typeof InputFieldComponent.email;
|
|
343
|
+
password: typeof InputFieldComponent.password;
|
|
344
|
+
};
|
|
345
|
+
|
|
281
346
|
type AsyncStoragePluginOptions = {};
|
|
282
347
|
declare const defaultAsyncStoragePluginOptions: Required<AsyncStoragePluginOptions>;
|
|
283
348
|
declare const asyncStoragePlugin: BetterComponentsPluginConstructor<AsyncStoragePluginOptions>;
|
|
284
349
|
|
|
285
|
-
export { Animate, type AnimateTextProps, type AnimateViewProps, type AppConfig, type AsyncStoragePluginOptions, type BetterComponentsConfig, type BetterComponentsPlugin, _default as BetterComponentsProvider, type BetterComponentsProviderConfig, Button, type ButtonProps, type ComponentMarginProps, type ComponentPaddingProps, type FooterProps, Loader, type LoaderProps, type LoaderSize, type PluginName, ScreenHolder, type ScreenHolderProps, Text, type TextProps, View, type ViewProps, asyncStoragePlugin, defaultAsyncStoragePluginOptions, generateAsyncStorage, pressStrength, useBetterComponentsContext, useDevice };
|
|
350
|
+
export { Animate, type AnimateTextProps, type AnimateViewProps, type AppConfig, type AsyncStoragePluginOptions, type BetterComponentsConfig, type BetterComponentsPlugin, _default as BetterComponentsProvider, type BetterComponentsProviderConfig, Button, type ButtonProps, type ComponentMarginProps, type ComponentPaddingProps, type FooterProps, Image, type ImageProps, InputField, type InputFieldProps, Loader, type LoaderProps, type LoaderSize, type PluginName, ScreenHolder, type ScreenHolderProps, Text, type TextProps, View, type ViewProps, asyncStoragePlugin, defaultAsyncStoragePluginOptions, generateAsyncStorage, pressStrength, useBetterComponentsContext, useDevice, useKeyboard };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { AnyOtherString, AssetName, AssetsConfig, Color, ColorName, ColorTheme,
|
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import * as react_native from 'react-native';
|
|
6
|
-
import { ViewStyle, GestureResponderEvent, ViewProps as ViewProps$1, TextProps as TextProps$1, TextStyle, ColorValue } from 'react-native';
|
|
6
|
+
import { ViewStyle, GestureResponderEvent, ViewProps as ViewProps$1, TextProps as TextProps$1, TextStyle, ColorValue, ImageSourcePropType, ImageProps as ImageProps$1, ImageStyle, TextInput, FocusEvent } from 'react-native';
|
|
7
7
|
import { EaseFunction, PropsTransforms } from '@legendapp/motion';
|
|
8
8
|
|
|
9
9
|
type AppConfig = {};
|
|
@@ -40,6 +40,9 @@ type ComponentMarginProps = Pick<ComponentStyle, "margin" | "marginTop" | "margi
|
|
|
40
40
|
type ComponentExcludeMarginProps = "marginBlock" | "marginBlockStart" | "marginBlockEnd" | "marginInline" | "marginInlineStart" | "marginInlineEnd" | "marginStart" | "marginEnd";
|
|
41
41
|
type ComponentPaddingProps = Pick<ComponentStyle, "padding" | "paddingTop" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingVertical" | "paddingHorizontal">;
|
|
42
42
|
type ComponentExcludePaddingProps = "paddingBlock" | "paddingBlockStart" | "paddingBlockEnd" | "paddingInline" | "paddingInlineStart" | "paddingInlineEnd" | "paddingStart" | "paddingEnd";
|
|
43
|
+
type ComponentPropWithRef<ComponentRef, ComponentProps> = ComponentProps & {
|
|
44
|
+
ref?: React.Ref<ComponentRef>;
|
|
45
|
+
};
|
|
43
46
|
|
|
44
47
|
declare const pressStrength: () => Record<"z05" | "z1" | "z2" | "z3", number>;
|
|
45
48
|
|
|
@@ -64,6 +67,11 @@ declare function useDevice(): {
|
|
|
64
67
|
/** @description Whether the device is small. */
|
|
65
68
|
isSmallDevice: boolean;
|
|
66
69
|
};
|
|
70
|
+
declare function useKeyboard(): {
|
|
71
|
+
isOpened: boolean;
|
|
72
|
+
willOpen: boolean;
|
|
73
|
+
height: number;
|
|
74
|
+
};
|
|
67
75
|
|
|
68
76
|
declare function generateAsyncStorage<AsyncStorage extends object>(): {
|
|
69
77
|
setItem: <StorageName extends keyof AsyncStorage>(name: StorageName, value: AsyncStorage[StorageName]) => void;
|
|
@@ -258,6 +266,8 @@ type ScreenHolderProps = {
|
|
|
258
266
|
/** @default 0 */
|
|
259
267
|
bottomSpace?: number;
|
|
260
268
|
footer?: React.ReactNode;
|
|
269
|
+
/** @default false */
|
|
270
|
+
keepFooterOnKeyboardOpened?: boolean;
|
|
261
271
|
children?: React.ReactNode;
|
|
262
272
|
};
|
|
263
273
|
type ScreenHolderComponentType = {
|
|
@@ -278,8 +288,63 @@ declare const ScreenHolder: typeof ScreenHolderComponent & {
|
|
|
278
288
|
footer: typeof ScreenHolderComponent.footer;
|
|
279
289
|
};
|
|
280
290
|
|
|
291
|
+
type ImageProps = {
|
|
292
|
+
name?: AssetName | AnyOtherString;
|
|
293
|
+
source?: ImageSourcePropType;
|
|
294
|
+
/** @default false */
|
|
295
|
+
withDevFittingMode?: boolean;
|
|
296
|
+
} & OmitProps<ImageProps$1, "source"> & ComponentStyle<ImageStyle>;
|
|
297
|
+
type ImageComponentType = {
|
|
298
|
+
(props: ImageProps): React.ReactElement;
|
|
299
|
+
profileImage: (props: OmitProps<ImageProps, "width" | "height"> & {
|
|
300
|
+
/** @default 50 */
|
|
301
|
+
size?: number;
|
|
302
|
+
letters?: string;
|
|
303
|
+
backgroundColor?: string;
|
|
304
|
+
}) => React.ReactElement;
|
|
305
|
+
};
|
|
306
|
+
declare const ImageComponent: ImageComponentType;
|
|
307
|
+
/** @description size is set to 100x100 by default */
|
|
308
|
+
declare const Image: typeof ImageComponent & {
|
|
309
|
+
profileImage: typeof ImageComponent.profileImage;
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
type InputFieldProps = {
|
|
313
|
+
placeholder?: string;
|
|
314
|
+
prefix?: string;
|
|
315
|
+
suffix?: string;
|
|
316
|
+
defaultValue?: string;
|
|
317
|
+
value?: string | number;
|
|
318
|
+
/** @default true */
|
|
319
|
+
editable?: boolean;
|
|
320
|
+
/** @default false */
|
|
321
|
+
autoFocus?: boolean;
|
|
322
|
+
autoCapitalize?: React.ComponentProps<typeof TextInput>["autoCapitalize"];
|
|
323
|
+
autoComplete?: React.ComponentProps<typeof TextInput>["autoComplete"];
|
|
324
|
+
autoCorrect?: React.ComponentProps<typeof TextInput>["autoCorrect"];
|
|
325
|
+
/** @default "default" */
|
|
326
|
+
keyboardAppearance?: React.ComponentProps<typeof TextInput>["keyboardAppearance"];
|
|
327
|
+
keyboardType?: React.ComponentProps<typeof TextInput>["keyboardType"];
|
|
328
|
+
/** @default false */
|
|
329
|
+
secureTextEntry?: boolean;
|
|
330
|
+
onFocus?: (event: FocusEvent) => void;
|
|
331
|
+
onBlur?: (event: FocusEvent) => void;
|
|
332
|
+
onChange?: (text: string) => void;
|
|
333
|
+
};
|
|
334
|
+
type InputFieldRef = {};
|
|
335
|
+
type InputFieldComponentType = {
|
|
336
|
+
(props: ComponentPropWithRef<InputFieldRef, InputFieldProps>): React.ReactElement;
|
|
337
|
+
email: (props: ComponentPropWithRef<InputFieldRef, InputFieldProps>) => React.ReactElement;
|
|
338
|
+
password: (props: ComponentPropWithRef<InputFieldRef, InputFieldProps>) => React.ReactElement;
|
|
339
|
+
};
|
|
340
|
+
declare const InputFieldComponent: InputFieldComponentType;
|
|
341
|
+
declare const InputField: typeof InputFieldComponent & {
|
|
342
|
+
email: typeof InputFieldComponent.email;
|
|
343
|
+
password: typeof InputFieldComponent.password;
|
|
344
|
+
};
|
|
345
|
+
|
|
281
346
|
type AsyncStoragePluginOptions = {};
|
|
282
347
|
declare const defaultAsyncStoragePluginOptions: Required<AsyncStoragePluginOptions>;
|
|
283
348
|
declare const asyncStoragePlugin: BetterComponentsPluginConstructor<AsyncStoragePluginOptions>;
|
|
284
349
|
|
|
285
|
-
export { Animate, type AnimateTextProps, type AnimateViewProps, type AppConfig, type AsyncStoragePluginOptions, type BetterComponentsConfig, type BetterComponentsPlugin, _default as BetterComponentsProvider, type BetterComponentsProviderConfig, Button, type ButtonProps, type ComponentMarginProps, type ComponentPaddingProps, type FooterProps, Loader, type LoaderProps, type LoaderSize, type PluginName, ScreenHolder, type ScreenHolderProps, Text, type TextProps, View, type ViewProps, asyncStoragePlugin, defaultAsyncStoragePluginOptions, generateAsyncStorage, pressStrength, useBetterComponentsContext, useDevice };
|
|
350
|
+
export { Animate, type AnimateTextProps, type AnimateViewProps, type AppConfig, type AsyncStoragePluginOptions, type BetterComponentsConfig, type BetterComponentsPlugin, _default as BetterComponentsProvider, type BetterComponentsProviderConfig, Button, type ButtonProps, type ComponentMarginProps, type ComponentPaddingProps, type FooterProps, Image, type ImageProps, InputField, type InputFieldProps, Loader, type LoaderProps, type LoaderSize, type PluginName, ScreenHolder, type ScreenHolderProps, Text, type TextProps, View, type ViewProps, asyncStoragePlugin, defaultAsyncStoragePluginOptions, generateAsyncStorage, pressStrength, useBetterComponentsContext, useDevice, useKeyboard };
|
package/dist/index.js
CHANGED
|
@@ -33,37 +33,40 @@ __export(index_exports, {
|
|
|
33
33
|
Animate: () => Animate_default,
|
|
34
34
|
BetterComponentsProvider: () => BetterComponentsProvider_default,
|
|
35
35
|
Button: () => Button_default,
|
|
36
|
+
Image: () => Image_default,
|
|
37
|
+
InputField: () => InputField_default,
|
|
36
38
|
Loader: () => Loader_default,
|
|
37
39
|
ScreenHolder: () => ScreenHolder_default,
|
|
38
40
|
Text: () => Text_default,
|
|
39
41
|
View: () => View_default,
|
|
40
42
|
asyncStoragePlugin: () => asyncStoragePlugin,
|
|
41
|
-
colorThemeControls: () =>
|
|
42
|
-
countries: () =>
|
|
43
|
-
darkenColor: () =>
|
|
43
|
+
colorThemeControls: () => import_react_better_core10.colorThemeControls,
|
|
44
|
+
countries: () => import_react_better_core10.countries,
|
|
45
|
+
darkenColor: () => import_react_better_core10.darkenColor,
|
|
44
46
|
defaultAsyncStoragePluginOptions: () => defaultAsyncStoragePluginOptions,
|
|
45
|
-
desaturateColor: () =>
|
|
46
|
-
eventPreventDefault: () =>
|
|
47
|
-
eventPreventStop: () =>
|
|
48
|
-
eventStopPropagation: () =>
|
|
49
|
-
formatPhoneNumber: () =>
|
|
47
|
+
desaturateColor: () => import_react_better_core10.desaturateColor,
|
|
48
|
+
eventPreventDefault: () => import_react_better_core10.eventPreventDefault,
|
|
49
|
+
eventPreventStop: () => import_react_better_core10.eventPreventStop,
|
|
50
|
+
eventStopPropagation: () => import_react_better_core10.eventStopPropagation,
|
|
51
|
+
formatPhoneNumber: () => import_react_better_core10.formatPhoneNumber,
|
|
50
52
|
generateAsyncStorage: () => generateAsyncStorage,
|
|
51
|
-
generateRandomString: () =>
|
|
52
|
-
getPluralWord: () =>
|
|
53
|
-
lightenColor: () =>
|
|
54
|
-
loaderControls: () =>
|
|
53
|
+
generateRandomString: () => import_react_better_core10.generateRandomString,
|
|
54
|
+
getPluralWord: () => import_react_better_core10.getPluralWord,
|
|
55
|
+
lightenColor: () => import_react_better_core10.lightenColor,
|
|
56
|
+
loaderControls: () => import_react_better_core10.loaderControls,
|
|
55
57
|
pressStrength: () => pressStrength,
|
|
56
|
-
saturateColor: () =>
|
|
58
|
+
saturateColor: () => import_react_better_core10.saturateColor,
|
|
57
59
|
useBetterComponentsContext: () => useBetterComponentsContext,
|
|
58
|
-
useBooleanState: () =>
|
|
59
|
-
useDebounceState: () =>
|
|
60
|
+
useBooleanState: () => import_react_better_core10.useBooleanState,
|
|
61
|
+
useDebounceState: () => import_react_better_core10.useDebounceState,
|
|
60
62
|
useDevice: () => useDevice,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
useKeyboard: () => useKeyboard,
|
|
64
|
+
useLoader: () => import_react_better_core10.useLoader,
|
|
65
|
+
useLoaderControls: () => import_react_better_core10.useLoaderControls,
|
|
66
|
+
useTheme: () => import_react_better_core10.useTheme
|
|
64
67
|
});
|
|
65
68
|
module.exports = __toCommonJS(index_exports);
|
|
66
|
-
var
|
|
69
|
+
var import_react_better_core10 = require("react-better-core");
|
|
67
70
|
|
|
68
71
|
// src/components/BetterComponentsProvider.tsx
|
|
69
72
|
var import_react = require("react");
|
|
@@ -406,6 +409,36 @@ function useDevice() {
|
|
|
406
409
|
isSmallDevice
|
|
407
410
|
};
|
|
408
411
|
}
|
|
412
|
+
function useKeyboard() {
|
|
413
|
+
const [keyboardOpened, setKeyboardOpened] = (0, import_react_better_core2.useBooleanState)();
|
|
414
|
+
const [keyboardWillOpen, setKeyboardWillOpen] = (0, import_react_better_core2.useBooleanState)();
|
|
415
|
+
const [keyboardHeight, setKeyboardHeight] = (0, import_react2.useState)(0);
|
|
416
|
+
(0, import_react2.useEffect)(() => {
|
|
417
|
+
const keyboardDidShow = (event) => {
|
|
418
|
+
setKeyboardOpened.setTrue();
|
|
419
|
+
setKeyboardHeight(event.endCoordinates.height);
|
|
420
|
+
};
|
|
421
|
+
const keyboardDidHide = () => {
|
|
422
|
+
setKeyboardOpened.setFalse();
|
|
423
|
+
setKeyboardHeight(0);
|
|
424
|
+
};
|
|
425
|
+
const willShowSubscription = import_react_native.Keyboard.addListener("keyboardWillShow", setKeyboardWillOpen.setTrue);
|
|
426
|
+
const willHideSubscription = import_react_native.Keyboard.addListener("keyboardWillHide", setKeyboardWillOpen.setFalse);
|
|
427
|
+
const didShowSubscription = import_react_native.Keyboard.addListener("keyboardDidShow", keyboardDidShow);
|
|
428
|
+
const didHideSubscription = import_react_native.Keyboard.addListener("keyboardDidHide", keyboardDidHide);
|
|
429
|
+
return () => {
|
|
430
|
+
willShowSubscription.remove();
|
|
431
|
+
willHideSubscription.remove();
|
|
432
|
+
didShowSubscription.remove();
|
|
433
|
+
didHideSubscription.remove();
|
|
434
|
+
};
|
|
435
|
+
}, []);
|
|
436
|
+
return {
|
|
437
|
+
isOpened: keyboardOpened,
|
|
438
|
+
willOpen: keyboardWillOpen,
|
|
439
|
+
height: keyboardHeight
|
|
440
|
+
};
|
|
441
|
+
}
|
|
409
442
|
function useComponentPropsGrouper(props, prefix) {
|
|
410
443
|
return (0, import_react2.useMemo)(() => {
|
|
411
444
|
const style = {};
|
|
@@ -718,6 +751,7 @@ var Text_default = Text2;
|
|
|
718
751
|
|
|
719
752
|
// src/components/Button.tsx
|
|
720
753
|
var import_react7 = require("react");
|
|
754
|
+
var import_react_native5 = require("react-native");
|
|
721
755
|
var import_react_better_core6 = require("react-better-core");
|
|
722
756
|
|
|
723
757
|
// src/components/Animate.tsx
|
|
@@ -879,6 +913,7 @@ var ButtonComponent = function Button({
|
|
|
879
913
|
const color = textColor ?? theme2.colors.base;
|
|
880
914
|
const paddingVertical = props.paddingVertical ? parseFloat(props.paddingVertical.toString()) : theme2.styles.space;
|
|
881
915
|
const paddingHorizontal = props.paddingHorizontal ? parseFloat(props.paddingHorizontal.toString()) : theme2.styles.space + theme2.styles.gap;
|
|
916
|
+
const buttonHeight = paddingVertical + lineHeight + paddingVertical;
|
|
882
917
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
883
918
|
Animate_default.View,
|
|
884
919
|
{
|
|
@@ -892,6 +927,7 @@ var ButtonComponent = function Button({
|
|
|
892
927
|
{
|
|
893
928
|
position: "relative",
|
|
894
929
|
width: !isSmall ? "100%" : void 0,
|
|
930
|
+
height: import_react_native5.Platform.OS === "android" ? buttonHeight : void 0,
|
|
895
931
|
alignItems: "center",
|
|
896
932
|
justifyContent: "center",
|
|
897
933
|
backgroundColor: theme2.colors.primary,
|
|
@@ -919,7 +955,7 @@ var ButtonComponent = function Button({
|
|
|
919
955
|
{
|
|
920
956
|
position: "absolute",
|
|
921
957
|
width: "100%",
|
|
922
|
-
height:
|
|
958
|
+
height: buttonHeight,
|
|
923
959
|
left: paddingHorizontal,
|
|
924
960
|
alignItems: "center",
|
|
925
961
|
justifyContent: "center",
|
|
@@ -978,7 +1014,7 @@ var Button_default = Button2;
|
|
|
978
1014
|
|
|
979
1015
|
// src/components/ScreenHolder.tsx
|
|
980
1016
|
var import_react8 = require("react");
|
|
981
|
-
var
|
|
1017
|
+
var import_react_native6 = require("react-native");
|
|
982
1018
|
var import_react_better_core7 = require("react-better-core");
|
|
983
1019
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
984
1020
|
var ScreenHolderComponent = ({
|
|
@@ -992,11 +1028,19 @@ var ScreenHolderComponent = ({
|
|
|
992
1028
|
insideBottomSafeArea,
|
|
993
1029
|
bottomSpace = 0,
|
|
994
1030
|
footer,
|
|
1031
|
+
keepFooterOnKeyboardOpened,
|
|
995
1032
|
children
|
|
996
1033
|
}) => {
|
|
997
1034
|
const theme2 = (0, import_react_better_core7.useTheme)();
|
|
998
1035
|
const device = useDevice();
|
|
1036
|
+
const keyboard = useKeyboard();
|
|
999
1037
|
const [isRefreshing, setIsRefreshing] = (0, import_react_better_core7.useBooleanState)();
|
|
1038
|
+
const keyboardAvoidingViewStyle = (0, import_react8.useMemo)(
|
|
1039
|
+
() => ({
|
|
1040
|
+
flex: 1
|
|
1041
|
+
}),
|
|
1042
|
+
[]
|
|
1043
|
+
);
|
|
1000
1044
|
const onRefreshElement = (0, import_react8.useCallback)(() => {
|
|
1001
1045
|
setIsRefreshing.setTrue();
|
|
1002
1046
|
onRefresh?.();
|
|
@@ -1011,21 +1055,29 @@ var ScreenHolderComponent = ({
|
|
|
1011
1055
|
flex: 1,
|
|
1012
1056
|
paddingHorizontal: !noSideSpace ? theme2.styles.space : void 0,
|
|
1013
1057
|
paddingTop: theme2.styles.gap + (insideTopSafeArea ? device.safeArea.afterCalculations.top : 0),
|
|
1014
|
-
paddingBottom: bottomSpace + (insideBottomSafeArea ? device.safeArea.afterCalculations.bottom : 0),
|
|
1058
|
+
paddingBottom: import_react_native6.Platform.OS === "ios" && keyboard.isOpened ? device.safeArea.afterCalculations.top : bottomSpace + (insideBottomSafeArea ? device.safeArea.afterCalculations.bottom : 0),
|
|
1015
1059
|
children
|
|
1016
1060
|
}
|
|
1017
1061
|
);
|
|
1018
1062
|
const withRefresh = onRefresh || onRefreshEnd;
|
|
1019
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1063
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(View_default, { flex: 1, backgroundColor: backgroundColor ?? theme2.colors.backgroundBase, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1064
|
+
import_react_native6.KeyboardAvoidingView,
|
|
1065
|
+
{
|
|
1066
|
+
style: keyboardAvoidingViewStyle,
|
|
1067
|
+
keyboardVerticalOffset: keepFooterOnKeyboardOpened ? import_react_native6.Platform.OS === "ios" ? device.safeArea.afterCalculations.bottom : theme2.styles.gap : void 0,
|
|
1068
|
+
behavior: import_react_native6.Platform.OS === "ios" ? "padding" : "height",
|
|
1069
|
+
children: [
|
|
1070
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(View_default, { flex: 1, children: noScroll ? content : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1071
|
+
import_react_native6.ScrollView,
|
|
1072
|
+
{
|
|
1073
|
+
refreshControl: withRefresh ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native6.RefreshControl, { refreshing: isRefreshing, onRefresh: onRefreshElement }) : void 0,
|
|
1074
|
+
children: content
|
|
1075
|
+
}
|
|
1076
|
+
) }),
|
|
1077
|
+
keepFooterOnKeyboardOpened || (import_react_native6.Platform.OS === "ios" ? !keyboard.willOpen : !keyboard.isOpened) ? footer && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(View_default, { children: footer }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(View_default, { width: "100%", height: device.safeArea.afterCalculations.bottom })
|
|
1078
|
+
]
|
|
1079
|
+
}
|
|
1080
|
+
) });
|
|
1029
1081
|
};
|
|
1030
1082
|
ScreenHolderComponent.footer = function Footer({
|
|
1031
1083
|
noSideSpace,
|
|
@@ -1050,6 +1102,242 @@ var ScreenHolder = (0, import_react8.memo)(ScreenHolderComponent);
|
|
|
1050
1102
|
ScreenHolder.footer = ScreenHolderComponent.footer;
|
|
1051
1103
|
var ScreenHolder_default = ScreenHolder;
|
|
1052
1104
|
|
|
1105
|
+
// src/components/Image.tsx
|
|
1106
|
+
var import_react9 = require("react");
|
|
1107
|
+
var import_react_better_core8 = require("react-better-core");
|
|
1108
|
+
var import_react_native7 = require("react-native");
|
|
1109
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1110
|
+
var ImageComponent = function Image({ name, source, withDevFittingMode, ...props }) {
|
|
1111
|
+
const { assets: assets2 } = (0, import_react_better_core8.useBetterCoreContext)();
|
|
1112
|
+
const style = (0, import_react9.useMemo)(
|
|
1113
|
+
() => ({
|
|
1114
|
+
width: 100,
|
|
1115
|
+
height: 100,
|
|
1116
|
+
...withDevFittingMode ? {
|
|
1117
|
+
borderWidth: 1,
|
|
1118
|
+
borderColor: "#eb39f7"
|
|
1119
|
+
} : {},
|
|
1120
|
+
...props
|
|
1121
|
+
}),
|
|
1122
|
+
[withDevFittingMode, props]
|
|
1123
|
+
);
|
|
1124
|
+
(0, import_react9.useEffect)(() => {
|
|
1125
|
+
if (!name) return;
|
|
1126
|
+
if (!assets2[name.toString()])
|
|
1127
|
+
console.warn(
|
|
1128
|
+
`The asset \`${name}\` you are trying to use does not exist. Make sure to add it to the \`assets\` object in \`<BetterComponentsProvider>\` config value prop.`
|
|
1129
|
+
);
|
|
1130
|
+
}, [assets2, name]);
|
|
1131
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_native7.Image, { source: name ? assets2[name.toString()] : source, style, ...props });
|
|
1132
|
+
};
|
|
1133
|
+
ImageComponent.profileImage = function ProfileImage({ size = 50, letters, backgroundColor, ...props }) {
|
|
1134
|
+
const theme2 = (0, import_react_better_core8.useTheme)();
|
|
1135
|
+
return letters ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1136
|
+
View_default,
|
|
1137
|
+
{
|
|
1138
|
+
width: size,
|
|
1139
|
+
height: size,
|
|
1140
|
+
backgroundColor: backgroundColor ?? theme2.colors.backgroundSecondary,
|
|
1141
|
+
borderWidth: 1,
|
|
1142
|
+
borderColor: theme2.colors.border,
|
|
1143
|
+
borderRadius: 999,
|
|
1144
|
+
alignItems: "center",
|
|
1145
|
+
justifyContent: "center",
|
|
1146
|
+
...props,
|
|
1147
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text_default, { fontSize: size / 2.5, fontWeight: 700, marginTop: 1, children: letters.toUpperCase().slice(0, 2) })
|
|
1148
|
+
}
|
|
1149
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1150
|
+
ImageComponent,
|
|
1151
|
+
{
|
|
1152
|
+
width: size,
|
|
1153
|
+
height: size,
|
|
1154
|
+
borderWidth: 1,
|
|
1155
|
+
borderColor: theme2.colors.border,
|
|
1156
|
+
borderRadius: 999,
|
|
1157
|
+
objectFit: "cover",
|
|
1158
|
+
...props
|
|
1159
|
+
}
|
|
1160
|
+
);
|
|
1161
|
+
};
|
|
1162
|
+
var Image2 = (0, import_react9.memo)(ImageComponent);
|
|
1163
|
+
Image2.profileImage = ImageComponent.profileImage;
|
|
1164
|
+
var Image_default = Image2;
|
|
1165
|
+
|
|
1166
|
+
// src/components/InputField.tsx
|
|
1167
|
+
var import_react10 = require("react");
|
|
1168
|
+
var import_react_native8 = require("react-native");
|
|
1169
|
+
var import_react_better_core9 = require("react-better-core");
|
|
1170
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1171
|
+
var InputFieldComponent = (0, import_react10.forwardRef)(
|
|
1172
|
+
({
|
|
1173
|
+
placeholder,
|
|
1174
|
+
prefix,
|
|
1175
|
+
suffix,
|
|
1176
|
+
defaultValue,
|
|
1177
|
+
value,
|
|
1178
|
+
editable = true,
|
|
1179
|
+
autoFocus,
|
|
1180
|
+
autoCapitalize,
|
|
1181
|
+
autoComplete,
|
|
1182
|
+
autoCorrect,
|
|
1183
|
+
keyboardAppearance = "default",
|
|
1184
|
+
keyboardType,
|
|
1185
|
+
secureTextEntry,
|
|
1186
|
+
onFocus,
|
|
1187
|
+
onBlur,
|
|
1188
|
+
onChange
|
|
1189
|
+
}, ref) => {
|
|
1190
|
+
const theme2 = (0, import_react_better_core9.useTheme)();
|
|
1191
|
+
const { colorTheme } = (0, import_react_better_core9.useBetterCoreContext)();
|
|
1192
|
+
const [internalValue, setInternalValue] = (0, import_react10.useState)(value?.toString() || defaultValue || "");
|
|
1193
|
+
const [isFocused, setIsFocused] = (0, import_react_better_core9.useBooleanState)();
|
|
1194
|
+
const paddingHorizontal = theme2.styles.space;
|
|
1195
|
+
const paddingVertical = (theme2.styles.space + theme2.styles.gap) / 2;
|
|
1196
|
+
const onFocusElement = (0, import_react10.useCallback)((event) => {
|
|
1197
|
+
setIsFocused.setTrue();
|
|
1198
|
+
onFocus?.(event);
|
|
1199
|
+
}, []);
|
|
1200
|
+
const onBlurElement = (0, import_react10.useCallback)((event) => {
|
|
1201
|
+
setIsFocused.setFalse();
|
|
1202
|
+
onBlur?.(event);
|
|
1203
|
+
}, []);
|
|
1204
|
+
const onChangeText = (0, import_react10.useCallback)(
|
|
1205
|
+
(text) => {
|
|
1206
|
+
setInternalValue(text);
|
|
1207
|
+
onChange?.(text);
|
|
1208
|
+
},
|
|
1209
|
+
[onChange]
|
|
1210
|
+
);
|
|
1211
|
+
const textInputStyle = (0, import_react10.useMemo)(
|
|
1212
|
+
() => ({
|
|
1213
|
+
flex: 1,
|
|
1214
|
+
fontSize: 16,
|
|
1215
|
+
lineHeight: 20,
|
|
1216
|
+
color: theme2.colors.textPrimary,
|
|
1217
|
+
paddingHorizontal,
|
|
1218
|
+
paddingVertical
|
|
1219
|
+
}),
|
|
1220
|
+
[theme2.colors, paddingHorizontal, paddingVertical]
|
|
1221
|
+
);
|
|
1222
|
+
(0, import_react10.useEffect)(() => {
|
|
1223
|
+
if (value === void 0) return;
|
|
1224
|
+
setInternalValue(value.toString());
|
|
1225
|
+
}, [value]);
|
|
1226
|
+
(0, import_react10.useImperativeHandle)(
|
|
1227
|
+
ref,
|
|
1228
|
+
() => {
|
|
1229
|
+
return {};
|
|
1230
|
+
},
|
|
1231
|
+
[]
|
|
1232
|
+
);
|
|
1233
|
+
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);
|
|
1234
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(View_default, { isRow: true, position: "relative", alignItems: "center", children: [
|
|
1235
|
+
prefix && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1236
|
+
View_default,
|
|
1237
|
+
{
|
|
1238
|
+
isRow: true,
|
|
1239
|
+
height: "100%",
|
|
1240
|
+
backgroundColor: prefixSuffixBackgroundColor,
|
|
1241
|
+
alignItems: "center",
|
|
1242
|
+
borderWidth: 1,
|
|
1243
|
+
borderRightWidth: 0,
|
|
1244
|
+
borderTopLeftRadius: theme2.styles.borderRadius,
|
|
1245
|
+
borderBottomLeftRadius: theme2.styles.borderRadius,
|
|
1246
|
+
borderColor: theme2.colors.border,
|
|
1247
|
+
paddingHorizontal,
|
|
1248
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text_default, { fontWeight: 700, children: prefix })
|
|
1249
|
+
}
|
|
1250
|
+
),
|
|
1251
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1252
|
+
Animate_default.View,
|
|
1253
|
+
{
|
|
1254
|
+
flex: 1,
|
|
1255
|
+
backgroundColor: theme2.colors.backgroundContent,
|
|
1256
|
+
borderTopLeftRadius: prefix ? 0 : theme2.styles.borderRadius,
|
|
1257
|
+
borderBottomLeftRadius: prefix ? 0 : theme2.styles.borderRadius,
|
|
1258
|
+
borderTopRightRadius: suffix ? 0 : theme2.styles.borderRadius,
|
|
1259
|
+
borderBottomRightRadius: suffix ? 0 : theme2.styles.borderRadius,
|
|
1260
|
+
borderWidth: 1,
|
|
1261
|
+
initialBorderColor: theme2.colors.border,
|
|
1262
|
+
animateBorderColor: isFocused ? theme2.colors.primary : theme2.colors.border,
|
|
1263
|
+
overflow: "hidden",
|
|
1264
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1265
|
+
import_react_native8.TextInput,
|
|
1266
|
+
{
|
|
1267
|
+
style: textInputStyle,
|
|
1268
|
+
value: internalValue,
|
|
1269
|
+
defaultValue,
|
|
1270
|
+
autoCapitalize,
|
|
1271
|
+
autoComplete,
|
|
1272
|
+
autoCorrect,
|
|
1273
|
+
autoFocus,
|
|
1274
|
+
placeholder,
|
|
1275
|
+
placeholderTextColor: theme2.colors.textSecondary + "80",
|
|
1276
|
+
readOnly: !editable,
|
|
1277
|
+
keyboardAppearance,
|
|
1278
|
+
keyboardType,
|
|
1279
|
+
cursorColor: theme2.colors.primary,
|
|
1280
|
+
selectionColor: theme2.colors.primary,
|
|
1281
|
+
secureTextEntry,
|
|
1282
|
+
onFocus: onFocusElement,
|
|
1283
|
+
onBlur: onBlurElement,
|
|
1284
|
+
onChangeText
|
|
1285
|
+
}
|
|
1286
|
+
)
|
|
1287
|
+
}
|
|
1288
|
+
),
|
|
1289
|
+
suffix && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1290
|
+
View_default,
|
|
1291
|
+
{
|
|
1292
|
+
isRow: true,
|
|
1293
|
+
height: "100%",
|
|
1294
|
+
backgroundColor: prefixSuffixBackgroundColor,
|
|
1295
|
+
alignItems: "center",
|
|
1296
|
+
borderWidth: 1,
|
|
1297
|
+
borderLeftWidth: 0,
|
|
1298
|
+
borderTopRightRadius: theme2.styles.borderRadius,
|
|
1299
|
+
borderBottomRightRadius: theme2.styles.borderRadius,
|
|
1300
|
+
borderColor: theme2.colors.border,
|
|
1301
|
+
paddingHorizontal,
|
|
1302
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text_default, { fontWeight: 700, children: suffix })
|
|
1303
|
+
}
|
|
1304
|
+
)
|
|
1305
|
+
] });
|
|
1306
|
+
}
|
|
1307
|
+
);
|
|
1308
|
+
InputFieldComponent.email = (0, import_react10.forwardRef)(function Email(props, ref) {
|
|
1309
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1310
|
+
InputFieldComponent,
|
|
1311
|
+
{
|
|
1312
|
+
placeholder: "your@email.here",
|
|
1313
|
+
autoComplete: "email",
|
|
1314
|
+
keyboardType: "email-address",
|
|
1315
|
+
autoCapitalize: "none",
|
|
1316
|
+
autoCorrect: false,
|
|
1317
|
+
...props,
|
|
1318
|
+
ref
|
|
1319
|
+
}
|
|
1320
|
+
);
|
|
1321
|
+
});
|
|
1322
|
+
InputFieldComponent.password = (0, import_react10.forwardRef)(function Password(props, ref) {
|
|
1323
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1324
|
+
InputFieldComponent,
|
|
1325
|
+
{
|
|
1326
|
+
secureTextEntry: true,
|
|
1327
|
+
placeholder: "******",
|
|
1328
|
+
autoCapitalize: "none",
|
|
1329
|
+
autoComplete: "password",
|
|
1330
|
+
autoCorrect: false,
|
|
1331
|
+
...props,
|
|
1332
|
+
ref
|
|
1333
|
+
}
|
|
1334
|
+
);
|
|
1335
|
+
});
|
|
1336
|
+
var InputField = (0, import_react10.memo)(InputFieldComponent);
|
|
1337
|
+
InputField.email = InputFieldComponent.email;
|
|
1338
|
+
InputField.password = InputFieldComponent.password;
|
|
1339
|
+
var InputField_default = InputField;
|
|
1340
|
+
|
|
1053
1341
|
// src/plugins/asyncStorage.ts
|
|
1054
1342
|
var defaultAsyncStoragePluginOptions = {};
|
|
1055
1343
|
var asyncStoragePlugin = (options) => ({
|
|
@@ -1067,6 +1355,8 @@ var asyncStoragePlugin = (options) => ({
|
|
|
1067
1355
|
Animate,
|
|
1068
1356
|
BetterComponentsProvider,
|
|
1069
1357
|
Button,
|
|
1358
|
+
Image,
|
|
1359
|
+
InputField,
|
|
1070
1360
|
Loader,
|
|
1071
1361
|
ScreenHolder,
|
|
1072
1362
|
Text,
|
|
@@ -1092,6 +1382,7 @@ var asyncStoragePlugin = (options) => ({
|
|
|
1092
1382
|
useBooleanState,
|
|
1093
1383
|
useDebounceState,
|
|
1094
1384
|
useDevice,
|
|
1385
|
+
useKeyboard,
|
|
1095
1386
|
useLoader,
|
|
1096
1387
|
useLoaderControls,
|
|
1097
1388
|
useTheme
|