sapo-components-ui-rn 1.0.81 → 1.0.82

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.
@@ -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.
@@ -7005,11 +7006,14 @@ var styles$2 = StyleSheet.create(__assign(__assign({}, containerStyles), { disab
7005
7006
  var index$1 = React__default.memo(SelectionField);
7006
7007
 
7007
7008
  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;
7009
+ 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 ? 300 : _f;
7009
7010
  var theme = useInternalTheme();
7010
7011
  var colors = theme.colors;
7012
+ var debouncedOnChangeText = useDebouncedCallback(function (text) {
7013
+ onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(text);
7014
+ }, debounceTime);
7011
7015
  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: onChangeText, style: [
7016
+ 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
7017
  {
7014
7018
  height: height || 36,
7015
7019
  },