"use strict";

exports.__esModule = true;
exports.default = void 0;
var _react = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
var _reactNativeAnimation = require("@coorpacademy/react-native-animation");
var _index = _interopRequireDefault(require("../../atom/loader/index.native"));
var _index2 = _interopRequireDefault(require("./player/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 styles = _reactNative.StyleSheet.create({
  rootView: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center'
  },
  player: {
    position: 'absolute',
    top: 0,
    left: 0,
    right: 0,
    bottom: 0,
    justifyContent: 'center',
    alignItems: 'center',
    flex: 1
  },
  loaderContainer: {
    position: 'absolute',
    top: 0,
    left: 0,
    right: 0,
    bottom: 0,
    justifyContent: 'center',
    alignItems: 'center'
  }
});
const AppReview = props => {
  const {
    navigateBack,
    viewName,
    slides
  } = props;
  (0, _react.useEffect)(() => {
    const backAction = () => {
      if (navigateBack) {
        navigateBack();
        return true;
      }
    };

    // https://reactnative.dev/docs/backhandler
    const backHandler = _reactNative.BackHandler.addEventListener('hardwareBackPress', backAction);
    return () => backHandler.remove();
  }, [navigateBack]);
  const fadePlayerIn = (0, _reactNativeAnimation.useAnimateProp)({
    property: 'opacity',
    fromValue: 0,
    toValue: 1,
    duration: 1250
  });
  const isLoading = viewName === 'loader';
  (0, _reactNativeAnimation.useAnimationWaiter)(isLoading, fadePlayerIn);
  return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
    style: styles.rootView
  }, /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
    style: [styles.player, _reactNative.Platform.OS === 'ios' ? fadePlayerIn.animatedStyle : null]
  }, slides ? /*#__PURE__*/_react.default.createElement(_index2.default, {
    congrats: slides.congrats,
    header: slides.header,
    stack: slides.stack,
    quitPopin: slides.quitPopin,
    backgroundImage: slides.backgroundImage
  }) : null), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
    style: styles.loaderContainer,
    pointerEvents: "none"
  }, /*#__PURE__*/_react.default.createElement(_index.default, {
    readyToHide: !isLoading
  })));
};
var _default = exports.default = AppReview;
//# sourceMappingURL=index.native.js.map