UNPKG

react-web-native-sketch

Version:

[TODO: We need an overview of how this can be used via npm vs as a local package]

38 lines 1.72 kB
"use strict"; var __assign = (this && this.__assign) || Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; Object.defineProperty(exports, "__esModule", { value: true }); var common_1 = require("src/nativeComponents/S3PhotoInput/common"); var common_2 = require("./common"); function onDrop(acceptedFiles, rejectedFiles, props) { var field = props.field, postPhotoToS3 = props.postPhotoToS3, showAlert = props.showAlert, t = props.t, minWidth = props.minWidth, maxWidth = props.maxWidth, minHeight = props.minHeight, maxHeight = props.maxHeight, fixedWidth = props.fixedWidth, fixedHeight = props.fixedHeight, ratioWidthHeight = props.ratioWidthHeight; var error = null; var file = acceptedFiles[0]; // if (!file.mime.match( 'image/*' )) { // todo file.mime is undefined // error = 'FILE_IS_NOT_IMAGE'; // } else { if (common_2.checkImageRestrictions(showAlert, t, file.width, file.height, minWidth, maxWidth, minHeight, maxHeight, fixedWidth, fixedHeight, ratioWidthHeight)) { var fieldData = { field: field, url: 'get_s3_upload_params', s3ExtraData: common_2.getPhotoDetails({ rawValue: __assign({}, file, { type: 'image/jpeg' }) }), preview: common_1.getImageUrl(common_2.getImagePreview({ rawValue: file })) }; postPhotoToS3(fieldData); } else { error = 'FILE_IS_INVALID'; } // } if (error) { showAlert(error); } } exports.onDrop = onDrop; //# sourceMappingURL=uploadUtils.native.js.map