function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
import { useRef, useState } from 'react';
import { TextInput, View } from 'react-native';
import { useStyles } from './styles';
import { SvgXml } from 'react-native-svg';
import { search } from '../../../core/assets/icons';
function SearchInput({
  iconProps,
  inputProps,
  style
}) {
  const ref = useRef(0);
  const {
    styles,
    theme
  } = useStyles();
  const [value, setValue] = useState(inputProps === null || inputProps === void 0 ? void 0 : inputProps.value);
  return /*#__PURE__*/React.createElement(View, {
    style: [styles.container, style]
  }, /*#__PURE__*/React.createElement(SvgXml, _extends({}, iconProps, {
    width: 20,
    height: 20,
    xml: search(),
    color: theme.colors.baseShade3
  })), /*#__PURE__*/React.createElement(TextInput, _extends({}, inputProps, {
    value: value,
    placeholder: inputProps === null || inputProps === void 0 ? void 0 : inputProps.placeholder,
    style: [styles.input, inputProps === null || inputProps === void 0 ? void 0 : inputProps.style],
    placeholderTextColor: theme.colors.baseShade2,
    onChangeText: text => {
      clearTimeout(ref.current);
      ref.current = setTimeout(() => inputProps === null || inputProps === void 0 ? void 0 : inputProps.onChangeText(text), 500);
      setValue(text);
    }
  })));
}
export default SearchInput;
//# sourceMappingURL=SearchInput.js.map