"use strict";

exports.__esModule = true;
exports.default = void 0;
var _react = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
var _index = _interopRequireDefault(require("../../../atom/text/index.native"));
var _index2 = _interopRequireDefault(require("../../touchable/index.native"));
var _templateContext = require("../../../template/app-review/template-context");
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 createStyleSheet = (brandTheme, theme) => _reactNative.StyleSheet.create({
  container: {
    backgroundColor: theme.colors.white,
    padding: theme.spacing.small
  },
  text: {
    fontWeight: theme.fontWeight.bold,
    color: theme.colors.black
  },
  selectedTextStyle: {
    color: brandTheme?.colors?.primary
  }
});
const ModalSelectItem = props => {
  const templateContext = (0, _templateContext.useTemplateContext)();
  const [styleSheet, setStylesheet] = (0, _react.useState)(null);
  const {
    brandTheme,
    theme
  } = templateContext;
  (0, _react.useEffect)(() => {
    const _stylesheet = createStyleSheet(brandTheme, theme);
    setStylesheet(_stylesheet);
  }, [theme, brandTheme]);
  if (!styleSheet) {
    return null;
  }
  const {
    children,
    onPress,
    isSelected,
    testID
  } = props;
  let textStyle = styleSheet.text;
  if (isSelected) {
    textStyle = {
      ...textStyle,
      ...styleSheet.selectedTextStyle
    };
  }
  return /*#__PURE__*/_react.default.createElement(_index2.default, {
    onPress: onPress,
    style: styleSheet.container,
    testID: testID
  }, /*#__PURE__*/_react.default.createElement(_index.default, {
    style: textStyle
  }, children));
};
var _default = exports.default = ModalSelectItem;
//# sourceMappingURL=index.native.js.map