"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = require("react");
var _reactNative = require("react-native");
var _styles = require("./styles");
var _reactNativeSvg = require("react-native-svg");
var _icons = require("../../../core/assets/icons");
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); }
function SearchInput({
  iconProps,
  inputProps,
  style
}) {
  const ref = (0, _react.useRef)(0);
  const {
    styles,
    theme
  } = (0, _styles.useStyles)();
  const [value, setValue] = (0, _react.useState)(inputProps === null || inputProps === void 0 ? void 0 : inputProps.value);
  return /*#__PURE__*/React.createElement(_reactNative.View, {
    style: [styles.container, style]
  }, /*#__PURE__*/React.createElement(_reactNativeSvg.SvgXml, _extends({}, iconProps, {
    width: 20,
    height: 20,
    xml: (0, _icons.search)(),
    color: theme.colors.baseShade3
  })), /*#__PURE__*/React.createElement(_reactNative.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);
    }
  })));
}
var _default = exports.default = SearchInput;
//# sourceMappingURL=SearchInput.js.map