@webority-technologies/mobile 0.0.11 → 0.0.12
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.
|
@@ -38,7 +38,7 @@ const sizeMap = {
|
|
|
38
38
|
const CANCEL_WIDTH = 72;
|
|
39
39
|
const SearchBar = exports.SearchBar = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
40
40
|
const {
|
|
41
|
-
value,
|
|
41
|
+
value: rawValue,
|
|
42
42
|
onChangeText,
|
|
43
43
|
onSubmit,
|
|
44
44
|
placeholder = 'Search…',
|
|
@@ -64,6 +64,11 @@ const SearchBar = exports.SearchBar = /*#__PURE__*/(0, _react.forwardRef)((props
|
|
|
64
64
|
};
|
|
65
65
|
const cancelWidth = theme.components.searchBar?.cancelButtonWidth ?? CANCEL_WIDTH;
|
|
66
66
|
const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
|
|
67
|
+
|
|
68
|
+
// Coerce nullable inputs to '' once at the top so every downstream read is
|
|
69
|
+
// a guaranteed string. Required when consumers pass `value={state}` where
|
|
70
|
+
// `state` may be `undefined` / `null` before being initialised.
|
|
71
|
+
const value = typeof rawValue === 'string' ? rawValue : '';
|
|
67
72
|
const [isFocused, setIsFocused] = (0, _react.useState)(false);
|
|
68
73
|
const [internalValue, setInternalValue] = (0, _react.useState)(value);
|
|
69
74
|
const debouncedValue = (0, _useDebounce.useDebounce)(internalValue, debounceMs ?? 0);
|
|
@@ -33,7 +33,7 @@ const sizeMap = {
|
|
|
33
33
|
const CANCEL_WIDTH = 72;
|
|
34
34
|
const SearchBar = /*#__PURE__*/forwardRef((props, ref) => {
|
|
35
35
|
const {
|
|
36
|
-
value,
|
|
36
|
+
value: rawValue,
|
|
37
37
|
onChangeText,
|
|
38
38
|
onSubmit,
|
|
39
39
|
placeholder = 'Search…',
|
|
@@ -59,6 +59,11 @@ const SearchBar = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
59
59
|
};
|
|
60
60
|
const cancelWidth = theme.components.searchBar?.cancelButtonWidth ?? CANCEL_WIDTH;
|
|
61
61
|
const styles = useMemo(() => buildStyles(theme), [theme]);
|
|
62
|
+
|
|
63
|
+
// Coerce nullable inputs to '' once at the top so every downstream read is
|
|
64
|
+
// a guaranteed string. Required when consumers pass `value={state}` where
|
|
65
|
+
// `state` may be `undefined` / `null` before being initialised.
|
|
66
|
+
const value = typeof rawValue === 'string' ? rawValue : '';
|
|
62
67
|
const [isFocused, setIsFocused] = useState(false);
|
|
63
68
|
const [internalValue, setInternalValue] = useState(value);
|
|
64
69
|
const debouncedValue = useDebounce(internalValue, debounceMs ?? 0);
|
|
@@ -4,7 +4,8 @@ import type { StyleProp, TextInputProps, ViewStyle } from 'react-native';
|
|
|
4
4
|
export type SearchBarSize = 'sm' | 'md' | 'lg';
|
|
5
5
|
export type SearchBarVariant = 'filled' | 'outlined';
|
|
6
6
|
export interface SearchBarProps extends Omit<TextInputProps, 'style' | 'value' | 'onChangeText'> {
|
|
7
|
-
value
|
|
7
|
+
/** Current value. Optional / nullable — treated as empty string when undefined or null. */
|
|
8
|
+
value?: string | null;
|
|
8
9
|
onChangeText: (text: string) => void;
|
|
9
10
|
onSubmit?: (text: string) => void;
|
|
10
11
|
placeholder?: string;
|
|
@@ -4,7 +4,8 @@ import type { StyleProp, TextInputProps, ViewStyle } from 'react-native';
|
|
|
4
4
|
export type SearchBarSize = 'sm' | 'md' | 'lg';
|
|
5
5
|
export type SearchBarVariant = 'filled' | 'outlined';
|
|
6
6
|
export interface SearchBarProps extends Omit<TextInputProps, 'style' | 'value' | 'onChangeText'> {
|
|
7
|
-
value
|
|
7
|
+
/** Current value. Optional / nullable — treated as empty string when undefined or null. */
|
|
8
|
+
value?: string | null;
|
|
8
9
|
onChangeText: (text: string) => void;
|
|
9
10
|
onSubmit?: (text: string) => void;
|
|
10
11
|
placeholder?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority-technologies/mobile",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"description": "Beautiful, animated, accessible React Native components plus API/auth/logging/network/storage utilities for Webority projects.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|