"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ViewFileScreen = void 0;
var _mobxReactLite = require("mobx-react-lite");
var _react = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
var _Styles = _interopRequireDefault(require("../../Styles"));
var _utils = require("../../utils");
var _components = require("../../components");
var _AppStore = _interopRequireDefault(require("../AppStore"));
var _ListChatStore = _interopRequireDefault(require("../listchat/ListChatStore"));
var _reactNativeWebview = require("react-native-webview");
var _reactNativeNavigation = require("react-native-navigation");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
const ViewFileScreen = (0, _mobxReactLite.observer)(function ViewFileScreen(props) {
  const [loading, setLoading] = (0, _react.useState)(true);
  return /*#__PURE__*/_react.default.createElement(_reactNative.SafeAreaView, {
    style: {
      flex: 1,
      backgroundColor: _Styles.default.primary
    }
  }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
    style: {
      height: (0, _utils.scale)(64),
      backgroundColor: _Styles.default.primary
    }
  }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
    style: {
      height: (0, _utils.scale)(64),
      flexDirection: 'row',
      alignItems: 'center'
    }
  }, /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
    onPress: () => {
      _reactNativeNavigation.Navigation.pop(props.componentId);
    },
    style: {
      width: 50,
      height: 50,
      justifyContent: 'center',
      alignItems: 'center'
    }
  }, /*#__PURE__*/_react.default.createElement(_reactNative.Image, {
    style: {
      height: 36,
      width: 36,
      resizeMode: 'contain'
    },
    source: require('../../assets/ic_back.png')
  })), /*#__PURE__*/_react.default.createElement(_components.MText, {
    style: {
      fontWeight: '600',
      fontSize: (0, _utils.scale)(17),
      color: 'white',
      flex: 1,
      textAlign: 'center',
      marginRight: 50
    }
  }, props.data.name))), /*#__PURE__*/_react.default.createElement(_reactNativeWebview.WebView, {
    style: {
      flex: 1,
      opacity: 0.99
    },
    scalesPageToFit: true,
    javaScriptEnabled: true,
    source: {
      uri: 'https://docs.google.com/viewer?url=' + props.data.url
    },
    onLoadEnd: () => setLoading(false)
  }), loading && /*#__PURE__*/_react.default.createElement(_reactNative.ActivityIndicator, {
    size: 'large',
    style: {
      position: 'absolute',
      top: '50%',
      left: '50%',
      right: '50%'
    }
  }));
});
exports.ViewFileScreen = ViewFileScreen;
//# sourceMappingURL=index.js.map