"use strict";

exports.__esModule = true;
exports.default = void 0;
var _reactNativeAnimation = require("@coorpacademy/react-native-animation");
var _react = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
var _index = _interopRequireDefault(require("../../../atom/loader/index.native"));
var _index2 = _interopRequireDefault(require("../../../organism/review-no-skills/index.native"));
var _index3 = _interopRequireDefault(require("../../../organism/review-skills/index.native"));
var _templateContext = require("../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 = theme => _reactNative.StyleSheet.create({
  container: {
    flex: 1,
    padding: 20,
    width: '100%',
    backgroundColor: theme.colors.white
  },
  loaderContainer: {
    position: 'absolute',
    top: 0,
    left: 0,
    right: 0,
    bottom: 0,
    justifyContent: 'center',
    alignItems: 'center'
  },
  title: {
    fontSize: theme.fontSize.xlarge,
    fontWeight: theme.fontWeight.bold,
    lineHeight: 28,
    color: theme.colors.text.primary,
    marginBottom: theme.spacing.base,
    marginTop: theme.spacing.small
  }
});
const ReviewSkills = props => {
  const {
    'aria-label': ariaLabel,
    title,
    isLoading,
    listSkills,
    titleNoSkills,
    textNoSkills,
    iconSkillAriaLabel
  } = props;
  const templateContext = (0, _templateContext.useTemplateContext)();
  const [styleSheet, setStylesheet] = (0, _react.useState)(null);
  const {
    theme
  } = templateContext;
  (0, _react.useEffect)(() => {
    const _stylesheet = createStyleSheet(theme);
    setStylesheet(_stylesheet);
  }, [theme]);
  const fadeResultsIn = (0, _reactNativeAnimation.useAnimateProp)({
    property: 'opacity',
    fromValue: 0,
    toValue: 1
  });
  (0, _reactNativeAnimation.useAnimationWaiter)(isLoading, fadeResultsIn);
  if (!styleSheet) {
    return null;
  }
  return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
    style: styleSheet.container,
    accessibilityLabel: ariaLabel
  }, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
    style: styleSheet.title
  }, title), /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
    style: fadeResultsIn.animatedStyle
  }, !listSkills || listSkills.length === 0 ? /*#__PURE__*/_react.default.createElement(_index2.default, {
    titleNoSkills: titleNoSkills,
    textNoSkills: textNoSkills,
    iconSkillAriaLabel: iconSkillAriaLabel
  }) : /*#__PURE__*/_react.default.createElement(_index3.default, {
    listSkills: listSkills
  })), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
    style: styleSheet.loaderContainer,
    pointerEvents: "none"
  }, /*#__PURE__*/_react.default.createElement(_index.default, {
    readyToHide: !isLoading
  })));
};
var _default = exports.default = ReviewSkills;
//# sourceMappingURL=index.native.js.map