function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
import React, { Component } from "react";
import { View, TouchableWithoutFeedback } from "react-native";
import { Text } from "./Text";
import { connect } from "react-redux";
import { getSiteSettingFromState } from "../helper";
import { TEXT_LIGHT, BOXGREY } from "../colours";
import { FontAwesome } from "./Icon";
import Config, { Services } from "../config";
class TouchableSearchBar extends Component {
  constructor(...args) {
    super(...args);
    _defineProperty(this, "onPressSearch", () => {
      Services.navigation.navigate("search", {
        priorityType: this.props.priorityType,
        searchName: this.props.searchName
      });
    });
  }
  render() {
    return /*#__PURE__*/React.createElement(TouchableWithoutFeedback, {
      onPress: this.onPressSearch
    }, /*#__PURE__*/React.createElement(View, {
      style: [styles.searchInputContainer, this.props.headerType !== "white" && {
        backgroundColor: "#fff"
      }, this.props.style]
    }, /*#__PURE__*/React.createElement(FontAwesome, {
      name: "magnifying-glass",
      style: styles.searchIcon
    }), /*#__PURE__*/React.createElement(Text, {
      style: styles.searchText
    }, `Search ${this.props.searchName}`)));
  }
}
const styles = {
  searchInputContainer: {
    flex: 1,
    height: 36,
    marginHorizontal: 16,
    marginVertical: 17,
    borderRadius: 25,
    backgroundColor: BOXGREY,
    alignItems: "center",
    justifyContent: "center",
    flexDirection: "row",
    paddingHorizontal: 16
  },
  searchIcon: {
    fontSize: 14,
    color: TEXT_LIGHT,
    marginRight: 8
  },
  searchText: {
    fontSize: 14,
    color: TEXT_LIGHT,
    fontFamily: "sf-medium"
  }
};
const mapStateToProps = state => {
  return {
    headerType: getSiteSettingFromState(state, "HeaderType", getSiteSettingFromState(state, "UseGradientHeader", Config.env.hasGradientHeader) ? "gradient" : "white")
  };
};
const touchableSearchBar = connect(mapStateToProps, {})(TouchableSearchBar);
export { touchableSearchBar as TouchableSearchBar };
//# sourceMappingURL=TouchableSearchBar.js.map