UNPKG

one

Version:

One is a React framework for web, iOS, and Android apps.

100 lines (98 loc) • 4.76 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var index_native_exports = {}; __export(index_native_exports, { VNDocumentCameraViewController: () => VNDocumentCameraViewController }); module.exports = __toCommonJS(index_native_exports); var import_react_native_nitro_modules = require("react-native-nitro-modules"); var import_nativeError = require("../nativeError.native.js"); function _class_call_check(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _create_class(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _define_property(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true }); } else obj[key] = value; return obj; } function create() { if (!import_react_native_nitro_modules.NitroModules.hasHybridObject("OneDocumentCamera")) { throw new Error("VNDocumentCameraViewController needs an iOS build"); } return import_react_native_nitro_modules.NitroModules.createHybridObject("OneDocumentCamera"); } var capabilities; var VNDocumentCameraViewController = /* @__PURE__ */ (function() { "use strict"; function VNDocumentCameraViewController2() { _class_call_check(this, VNDocumentCameraViewController2); _define_property(this, "delegate", null); _define_property(this, "native", create()); } _create_class(VNDocumentCameraViewController2, [{ key: "present", value: function present() { var _this = this; var animated = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true; return this.native.present(animated, function(scan) { var _this_delegate_documentCameraViewController, _this_delegate; return (_this_delegate = _this.delegate) === null || _this_delegate === void 0 ? void 0 : (_this_delegate_documentCameraViewController = _this_delegate.documentCameraViewController) === null || _this_delegate_documentCameraViewController === void 0 ? void 0 : _this_delegate_documentCameraViewController.call(_this_delegate, _this, { didFinishWith: scan }); }, function() { var _this_delegate_documentCameraViewControllerDidCancel, _this_delegate; return (_this_delegate = _this.delegate) === null || _this_delegate === void 0 ? void 0 : (_this_delegate_documentCameraViewControllerDidCancel = _this_delegate.documentCameraViewControllerDidCancel) === null || _this_delegate_documentCameraViewControllerDidCancel === void 0 ? void 0 : _this_delegate_documentCameraViewControllerDidCancel.call(_this_delegate, _this); }, function(error) { var _this_delegate_documentCameraViewController, _this_delegate; return (_this_delegate = _this.delegate) === null || _this_delegate === void 0 ? void 0 : (_this_delegate_documentCameraViewController = _this_delegate.documentCameraViewController) === null || _this_delegate_documentCameraViewController === void 0 ? void 0 : _this_delegate_documentCameraViewController.call(_this_delegate, _this, { didFailWith: error }); }).catch(import_nativeError.rethrowNativeError); } }, { key: "dismiss", value: function dismiss() { var animated = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true; return this.native.dismiss(animated).catch(import_nativeError.rethrowNativeError); } }], [{ key: "isSupported", get: function get() { return (capabilities !== null && capabilities !== void 0 ? capabilities : capabilities = create()).isSupported; } }]); return VNDocumentCameraViewController2; })();