sapo-components-ui-rn 1.0.81 → 1.0.83
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/components/SearchInput/index.d.ts +2 -1
- package/dist/index.esm.js +8 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/src/components/Button/index.tsx +13 -11
- package/src/components/SearchInput/index.tsx +9 -1
|
@@ -13,6 +13,7 @@ interface SearchInputProps {
|
|
|
13
13
|
onBlur?: () => void;
|
|
14
14
|
onChangeText?: (text: string) => void;
|
|
15
15
|
height?: number;
|
|
16
|
+
debounceTime?: number;
|
|
16
17
|
}
|
|
17
|
-
declare const SearchInput: ({ value, disabled, rightIcon, clearButton, placeholder, onFocus, onBlur, onChangeText, style, height, }: SearchInputProps) => React.JSX.Element;
|
|
18
|
+
declare const SearchInput: ({ value, disabled, rightIcon, clearButton, placeholder, onFocus, onBlur, onChangeText, style, height, debounceTime, }: SearchInputProps) => React.JSX.Element;
|
|
18
19
|
export default SearchInput;
|
package/dist/index.esm.js
CHANGED
|
@@ -9,6 +9,7 @@ import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
|
|
9
9
|
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
10
10
|
import Svg, { Rect, Path, Circle } from 'react-native-svg';
|
|
11
11
|
import { useSafeAreaInsets, SafeAreaProvider } from 'react-native-safe-area-context';
|
|
12
|
+
import { useDebouncedCallback } from 'use-debounce';
|
|
12
13
|
|
|
13
14
|
/******************************************************************************
|
|
14
15
|
Copyright (c) Microsoft Corporation.
|
|
@@ -6324,7 +6325,8 @@ var Button = function (_a) {
|
|
|
6324
6325
|
React__default.createElement(Spacer, { width: left ? CONSTANTS.SPACE_12 : CONSTANTS.SPACE_16 }),
|
|
6325
6326
|
!isLoading && left,
|
|
6326
6327
|
left && React__default.createElement(Spacer, { width: CONSTANTS.SPACE_8 }),
|
|
6327
|
-
isLoading ? (React__default.createElement(ActivityIndicator, { color: (textStyle === null || textStyle === void 0 ? void 0 : textStyle.color) || renderTextColor() })) : (React__default.createElement(
|
|
6328
|
+
isLoading ? (React__default.createElement(ActivityIndicator, { color: (textStyle === null || textStyle === void 0 ? void 0 : textStyle.color) || renderTextColor() })) : (React__default.createElement(View, { full: true },
|
|
6329
|
+
React__default.createElement(Text$1, __assign({ numberOfLines: 1, color: textColor || renderTextColor(), size: size, bold: bold, medium: medium, style: [disabled && disabledTextStyle, textStyle] }, textProps), title))),
|
|
6328
6330
|
right && React__default.createElement(Spacer, { width: CONSTANTS.SPACE_8 }),
|
|
6329
6331
|
!isLoading && right,
|
|
6330
6332
|
React__default.createElement(Spacer, { width: right ? CONSTANTS.SPACE_12 : CONSTANTS.SPACE_16 })))));
|
|
@@ -7005,11 +7007,14 @@ var styles$2 = StyleSheet.create(__assign(__assign({}, containerStyles), { disab
|
|
|
7005
7007
|
var index$1 = React__default.memo(SelectionField);
|
|
7006
7008
|
|
|
7007
7009
|
var SearchInput = function (_a) {
|
|
7008
|
-
var _b = _a.value, value = _b === void 0 ? "" : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c, rightIcon = _a.rightIcon, _d = _a.clearButton, clearButton = _d === void 0 ? false : _d, _e = _a.placeholder, placeholder = _e === void 0 ? "Tìm kiếm" : _e, onFocus = _a.onFocus, onBlur = _a.onBlur, onChangeText = _a.onChangeText, style = _a.style, height = _a.height;
|
|
7010
|
+
var _b = _a.value, value = _b === void 0 ? "" : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c, rightIcon = _a.rightIcon, _d = _a.clearButton, clearButton = _d === void 0 ? false : _d, _e = _a.placeholder, placeholder = _e === void 0 ? "Tìm kiếm" : _e, onFocus = _a.onFocus, onBlur = _a.onBlur, onChangeText = _a.onChangeText, style = _a.style, height = _a.height, _f = _a.debounceTime, debounceTime = _f === void 0 ? 500 : _f;
|
|
7009
7011
|
var theme = useInternalTheme();
|
|
7010
7012
|
var colors = theme.colors;
|
|
7013
|
+
var debouncedOnChangeText = useDebouncedCallback(function (text) {
|
|
7014
|
+
onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(text);
|
|
7015
|
+
}, debounceTime);
|
|
7011
7016
|
return (React__default.createElement(TextInput, { left: React__default.createElement(View, null,
|
|
7012
|
-
React__default.createElement(Icon$1, { name: "IconSearch", type: "Svg", size: 18 })), disabled: disabled, value: value, clearButton: clearButton, mode: "default", label: placeholder, placeholder: placeholder, right: rightIcon, onFocus: onFocus, onBlur: onBlur, allowFontScaling: false, onChangeText:
|
|
7017
|
+
React__default.createElement(Icon$1, { name: "IconSearch", type: "Svg", size: 18 })), disabled: disabled, value: value, clearButton: clearButton, mode: "default", label: placeholder, placeholder: placeholder, right: rightIcon, onFocus: onFocus, onBlur: onBlur, allowFontScaling: false, onChangeText: debouncedOnChangeText, style: [
|
|
7013
7018
|
{
|
|
7014
7019
|
height: height || 36,
|
|
7015
7020
|
},
|