"use strict";

exports.__esModule = true;
exports.default = void 0;
var _react = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
var _index = _interopRequireDefault(require("../text/index.native"));
var _templateContext = require("../../template/app-review/template-context");
var _index2 = _interopRequireDefault(require("../../hoc/touchable/index.native"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
const createStyle = (theme, brandTheme) => _reactNative.StyleSheet.create({
  wrapper: {
    backgroundColor: brandTheme?.colors?.primary || theme.colors.text.primary,
    borderRadius: 7,
    width: '100%'
  },
  text: {
    fontSize: 14,
    lineHeight: 20,
    fontWeight: '700',
    color: theme.colors.white,
    marginBottom: 16,
    marginTop: 16,
    textAlign: 'center'
  }
});
const Button = props => {
  const {
    accessibilityLabel,
    disabled,
    onPress,
    style,
    submitValue,
    testID,
    textStyle
  } = props;
  const {
    theme,
    brandTheme
  } = (0, _templateContext.useTemplateContext)();
  const [styleSheet, setStylesheet] = (0, _react.useState)();
  (0, _react.useEffect)(() => {
    const _style = createStyle(theme, brandTheme);
    setStylesheet(_style);
  }, [theme, brandTheme]);
  if (!styleSheet) return null;
  const _textStyle = {
    ...styleSheet.text,
    ...textStyle
  };
  return /*#__PURE__*/_react.default.createElement(_index2.default, {
    testID: testID,
    onPress: onPress,
    disabled: disabled,
    accessibilityLabel: accessibilityLabel,
    style: [styleSheet.wrapper, style]
  }, /*#__PURE__*/_react.default.createElement(_index.default, {
    style: _textStyle
  }, submitValue));
};
var _default = exports.default = Button;
//# sourceMappingURL=index.native.js.map