UNPKG

one

Version:

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

79 lines (76 loc) • 3.75 kB
import { NitroModules } from "react-native-nitro-modules"; import { rethrowNativeError } from "../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 (!NitroModules.hasHybridObject("OneDocumentCamera")) { throw new Error("VNDocumentCameraViewController needs an iOS build"); } return 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(rethrowNativeError); } }, { key: "dismiss", value: function dismiss() { var animated = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true; return this.native.dismiss(animated).catch(rethrowNativeError); } }], [{ key: "isSupported", get: function get() { return (capabilities !== null && capabilities !== void 0 ? capabilities : capabilities = create()).isSupported; } }]); return VNDocumentCameraViewController2; })(); export { VNDocumentCameraViewController }; //# sourceMappingURL=index.native.js.map