function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
import React, { Component } from "react";
import { View, StyleSheet } from "react-native";
import { Text } from "./Text";
import { InlineButton } from "./InlineButton";
import { Spinner } from "./Spinner";
class ImageUploadProgress extends Component {
  constructor(...args) {
    super(...args);
    _defineProperty(this, "onRetryUpload", (imageUri, uploadUri) => {
      this.props.uploader.retryUpload(imageUri, uploadUri);
    });
  }
  render() {
    const {
      color,
      image,
      style,
      progressTextStyle,
      retryTextStyle
    } = this.props;
    const {
      imageUri,
      uploadUri,
      uploadProgress,
      allowRetry
    } = image;
    return /*#__PURE__*/React.createElement(View, {
      style: [styles.container, style]
    }, /*#__PURE__*/React.createElement(Spinner, {
      style: styles.spinner
    }), /*#__PURE__*/React.createElement(Text, {
      style: [styles.uploadProgressText, progressTextStyle, {
        color
      }]
    }, uploadProgress), allowRetry && /*#__PURE__*/React.createElement(InlineButton, {
      color: color,
      onPress: () => this.onRetryUpload(imageUri, uploadUri),
      touchableStyle: styles.retryButton
    }, /*#__PURE__*/React.createElement(Text, {
      style: [styles.retryText, retryTextStyle]
    }, "Retry")));
  }
}
const styles = StyleSheet.create({
  container: {
    alignItems: "center",
    justifyContent: "center"
  },
  spinner: {
    flex: 0
  },
  uploadProgressText: {
    textAlign: "center",
    fontFamily: "sf-semibold",
    fontSize: 12
  },
  retryButton: {
    marginTop: 10
  },
  retryText: {
    fontFamily: "sf-semibold",
    fontSize: 12
  }
});
export default ImageUploadProgress;
//# sourceMappingURL=ImageUploadProgress.js.map