react-native-better-html 1.0.16 → 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 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, TextInput, TextStyle, FocusEvent, NativeSyntheticEvent, NativeTouchEvent, TextInputSubmitEditingEvent, TextProps as TextProps$1, ColorValue, ImageSourcePropType, ImageProps as ImageProps$1, ImageStyle, StatusBar as StatusBar$1 } from 'react-native';
6
+ import { ViewStyle, GestureResponderEvent, ViewProps as ViewProps$1, TextInput, TextStyle, NativeSyntheticEvent, NativeTouchEvent, FocusEvent, TextInputSubmitEditingEvent, TextProps as TextProps$1, ColorValue, ImageSourcePropType, ImageProps as ImageProps$1, ImageStyle, StatusBar as StatusBar$1 } from 'react-native';
7
7
  import { SymbolView } from 'expo-symbols';
8
8
  import { EaseFunction, PropsTransforms } from '@legendapp/motion';
9
9
 
@@ -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$1: react.MemoExoticComponent<typeof BetterComponentsProvider>;
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,14 +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?: React.ComponentProps<typeof SymbolView>["name"];
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;
87
+ declare const _default$3: react.MemoExoticComponent<typeof Icon>;
86
88
 
87
89
  type InputFieldProps = {
88
90
  flex?: ViewStyle["flex"];
@@ -106,7 +108,6 @@ type InputFieldProps = {
106
108
  autoCapitalize?: React.ComponentProps<typeof TextInput>["autoCapitalize"];
107
109
  autoComplete?: React.ComponentProps<typeof TextInput>["autoComplete"];
108
110
  autoCorrect?: React.ComponentProps<typeof TextInput>["autoCorrect"];
109
- /** @default "default" */
110
111
  keyboardAppearance?: React.ComponentProps<typeof TextInput>["keyboardAppearance"];
111
112
  keyboardType?: React.ComponentProps<typeof TextInput>["keyboardType"];
112
113
  /** @default false */
@@ -132,8 +133,10 @@ type InputFieldProps = {
132
133
  numberOfLines?: number;
133
134
  leftIcon?: IconProps["name"];
134
135
  leftIconIOS?: IconProps["nameIOS"];
136
+ onPressLeftIcon?: (event: NativeSyntheticEvent<NativeTouchEvent>) => void;
135
137
  rightIcon?: IconProps["name"];
136
138
  rightIconIOS?: IconProps["nameIOS"];
139
+ onPressRightIcon?: (event: NativeSyntheticEvent<NativeTouchEvent>) => void;
137
140
  onFocus?: (event: FocusEvent) => void;
138
141
  onBlur?: (event: FocusEvent) => void;
139
142
  onChange?: (text: string) => void;
@@ -161,6 +164,16 @@ declare const InputField: typeof InputFieldComponent & {
161
164
  code: typeof InputFieldComponent.code;
162
165
  };
163
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
+
164
177
  declare function useDevice(): {
165
178
  safeArea: {
166
179
  /** @description The safe area insets after calculations. Recommended to use this instead of the raw insets. */
@@ -204,6 +217,7 @@ declare function useForm<FormFields extends Record<string | number, FormFieldVal
204
217
  setFieldValue: <FieldName extends keyof FormFields>(field: FieldName, value: FormFields[FieldName] | undefined) => void;
205
218
  setFieldsValue: (values: Partial<FormFields>) => void;
206
219
  getInputFieldProps: <FieldName extends keyof FormFields>(field: FieldName) => ComponentPropWithRef<InputFieldRef, InputFieldProps>;
220
+ getSwitchProps: <FieldName extends keyof FormFields>(field: FieldName, insideListItem?: boolean) => SwitchProps;
207
221
  focusField: (field: keyof FormFields) => void;
208
222
  inputFieldRefs: Record<keyof FormFields, TextInput | undefined>;
209
223
  validate: () => {};
@@ -214,6 +228,10 @@ declare function useForm<FormFields extends Record<string | number, FormFieldVal
214
228
  isValid: boolean;
215
229
  canSubmit: boolean;
216
230
  };
231
+ declare function useEventEmitter(): {
232
+ emit: <Params>(eventName: string, params?: Params) => void;
233
+ listen: <Params>(eventName: string, callback?: (params?: Params) => void) => react_native.EmitterSubscription;
234
+ };
217
235
 
218
236
  declare const getFormErrorObject: <FormFields extends ReturnType<typeof useForm>["values"]>(formValues: FormFields) => PartialRecord<keyof FormFields, string>;
219
237
 
@@ -421,7 +439,8 @@ type ImageComponentType = {
421
439
  /** @default 50 */
422
440
  size?: number;
423
441
  letters?: string;
424
- backgroundColor?: string;
442
+ color?: ColorValue;
443
+ backgroundColor?: ColorValue;
425
444
  }) => React.ReactElement;
426
445
  };
427
446
  declare const ImageComponent: ImageComponentType;
@@ -439,10 +458,28 @@ type StatusBarProps = {
439
458
  iOSBarStyle?: React.ComponentProps<typeof StatusBar$1>["barStyle"];
440
459
  };
441
460
  declare function StatusBar({ darkStatusBar, hidden, barStyle, androidBarStyle, iOSBarStyle }: StatusBarProps): react_jsx_runtime.JSX.Element;
442
- 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>;
443
480
 
444
481
  type AsyncStoragePluginOptions = {};
445
482
  declare const defaultAsyncStoragePluginOptions: Required<AsyncStoragePluginOptions>;
446
483
  declare const asyncStoragePlugin: BetterComponentsPluginConstructor<AsyncStoragePluginOptions>;
447
484
 
448
- export { Animate, type AnimateTextProps, type AnimateViewProps, type AppConfig, type AsyncStoragePluginOptions, type BetterComponentsConfig, type BetterComponentsPlugin, _default$1 as BetterComponentsProvider, type BetterComponentsProviderConfig, Button, type ButtonProps, type ComponentMarginProps, type ComponentPaddingProps, type FooterProps, Icon, type IconProps, Image, type ImageProps, InputField, type InputFieldProps, type InputFieldRef, Loader, type LoaderProps, type LoaderSize, type PluginName, ScreenHolder, type ScreenHolderProps, _default as StatusBar, type StatusBarProps, Text, type TextProps, View, type ViewProps, asyncStoragePlugin, defaultAsyncStoragePluginOptions, generateAsyncStorage, getFormErrorObject, pressStrength, useBetterComponentsContext, useDevice, useForm, useKeyboard };
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
@@ -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, TextInput, TextStyle, FocusEvent, NativeSyntheticEvent, NativeTouchEvent, TextInputSubmitEditingEvent, TextProps as TextProps$1, ColorValue, ImageSourcePropType, ImageProps as ImageProps$1, ImageStyle, StatusBar as StatusBar$1 } from 'react-native';
6
+ import { ViewStyle, GestureResponderEvent, ViewProps as ViewProps$1, TextInput, TextStyle, NativeSyntheticEvent, NativeTouchEvent, FocusEvent, TextInputSubmitEditingEvent, TextProps as TextProps$1, ColorValue, ImageSourcePropType, ImageProps as ImageProps$1, ImageStyle, StatusBar as StatusBar$1 } from 'react-native';
7
7
  import { SymbolView } from 'expo-symbols';
8
8
  import { EaseFunction, PropsTransforms } from '@legendapp/motion';
9
9
 
@@ -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$1: react.MemoExoticComponent<typeof BetterComponentsProvider>;
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,14 +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?: React.ComponentProps<typeof SymbolView>["name"];
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;
87
+ declare const _default$3: react.MemoExoticComponent<typeof Icon>;
86
88
 
87
89
  type InputFieldProps = {
88
90
  flex?: ViewStyle["flex"];
@@ -106,7 +108,6 @@ type InputFieldProps = {
106
108
  autoCapitalize?: React.ComponentProps<typeof TextInput>["autoCapitalize"];
107
109
  autoComplete?: React.ComponentProps<typeof TextInput>["autoComplete"];
108
110
  autoCorrect?: React.ComponentProps<typeof TextInput>["autoCorrect"];
109
- /** @default "default" */
110
111
  keyboardAppearance?: React.ComponentProps<typeof TextInput>["keyboardAppearance"];
111
112
  keyboardType?: React.ComponentProps<typeof TextInput>["keyboardType"];
112
113
  /** @default false */
@@ -132,8 +133,10 @@ type InputFieldProps = {
132
133
  numberOfLines?: number;
133
134
  leftIcon?: IconProps["name"];
134
135
  leftIconIOS?: IconProps["nameIOS"];
136
+ onPressLeftIcon?: (event: NativeSyntheticEvent<NativeTouchEvent>) => void;
135
137
  rightIcon?: IconProps["name"];
136
138
  rightIconIOS?: IconProps["nameIOS"];
139
+ onPressRightIcon?: (event: NativeSyntheticEvent<NativeTouchEvent>) => void;
137
140
  onFocus?: (event: FocusEvent) => void;
138
141
  onBlur?: (event: FocusEvent) => void;
139
142
  onChange?: (text: string) => void;
@@ -161,6 +164,16 @@ declare const InputField: typeof InputFieldComponent & {
161
164
  code: typeof InputFieldComponent.code;
162
165
  };
163
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
+
164
177
  declare function useDevice(): {
165
178
  safeArea: {
166
179
  /** @description The safe area insets after calculations. Recommended to use this instead of the raw insets. */
@@ -204,6 +217,7 @@ declare function useForm<FormFields extends Record<string | number, FormFieldVal
204
217
  setFieldValue: <FieldName extends keyof FormFields>(field: FieldName, value: FormFields[FieldName] | undefined) => void;
205
218
  setFieldsValue: (values: Partial<FormFields>) => void;
206
219
  getInputFieldProps: <FieldName extends keyof FormFields>(field: FieldName) => ComponentPropWithRef<InputFieldRef, InputFieldProps>;
220
+ getSwitchProps: <FieldName extends keyof FormFields>(field: FieldName, insideListItem?: boolean) => SwitchProps;
207
221
  focusField: (field: keyof FormFields) => void;
208
222
  inputFieldRefs: Record<keyof FormFields, TextInput | undefined>;
209
223
  validate: () => {};
@@ -214,6 +228,10 @@ declare function useForm<FormFields extends Record<string | number, FormFieldVal
214
228
  isValid: boolean;
215
229
  canSubmit: boolean;
216
230
  };
231
+ declare function useEventEmitter(): {
232
+ emit: <Params>(eventName: string, params?: Params) => void;
233
+ listen: <Params>(eventName: string, callback?: (params?: Params) => void) => react_native.EmitterSubscription;
234
+ };
217
235
 
218
236
  declare const getFormErrorObject: <FormFields extends ReturnType<typeof useForm>["values"]>(formValues: FormFields) => PartialRecord<keyof FormFields, string>;
219
237
 
@@ -421,7 +439,8 @@ type ImageComponentType = {
421
439
  /** @default 50 */
422
440
  size?: number;
423
441
  letters?: string;
424
- backgroundColor?: string;
442
+ color?: ColorValue;
443
+ backgroundColor?: ColorValue;
425
444
  }) => React.ReactElement;
426
445
  };
427
446
  declare const ImageComponent: ImageComponentType;
@@ -439,10 +458,28 @@ type StatusBarProps = {
439
458
  iOSBarStyle?: React.ComponentProps<typeof StatusBar$1>["barStyle"];
440
459
  };
441
460
  declare function StatusBar({ darkStatusBar, hidden, barStyle, androidBarStyle, iOSBarStyle }: StatusBarProps): react_jsx_runtime.JSX.Element;
442
- 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>;
443
480
 
444
481
  type AsyncStoragePluginOptions = {};
445
482
  declare const defaultAsyncStoragePluginOptions: Required<AsyncStoragePluginOptions>;
446
483
  declare const asyncStoragePlugin: BetterComponentsPluginConstructor<AsyncStoragePluginOptions>;
447
484
 
448
- export { Animate, type AnimateTextProps, type AnimateViewProps, type AppConfig, type AsyncStoragePluginOptions, type BetterComponentsConfig, type BetterComponentsPlugin, _default$1 as BetterComponentsProvider, type BetterComponentsProviderConfig, Button, type ButtonProps, type ComponentMarginProps, type ComponentPaddingProps, type FooterProps, Icon, type IconProps, Image, type ImageProps, InputField, type InputFieldProps, type InputFieldRef, Loader, type LoaderProps, type LoaderSize, type PluginName, ScreenHolder, type ScreenHolderProps, _default as StatusBar, type StatusBarProps, Text, type TextProps, View, type ViewProps, asyncStoragePlugin, defaultAsyncStoragePluginOptions, generateAsyncStorage, getFormErrorObject, pressStrength, useBetterComponentsContext, useDevice, useForm, useKeyboard };
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 };