UNPKG

one

Version:

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

37 lines (34 loc) • 1.12 kB
import { NitroModules } from "react-native-nitro-modules"; import { rethrowNativeError } from "../nativeError.native.js"; import { resolveDocumentPickerOptions } from "./options.native.js"; var hybrid; function native(verb) { if (hybrid === void 0) { hybrid = NitroModules.hasHybridObject("OneDocumentPicker") ? NitroModules.createHybridObject("OneDocumentPicker") : null; } if (!hybrid) { throw new Error(`DocumentPicker.${verb} needs a native build`); } return hybrid; } function toResult(result) { if (result.canceled) return { canceled: true, assets: null }; if (!result.assets) { throw new Error("DocumentPicker: native returned a pick without assets"); } return { canceled: false, assets: result.assets }; } function getDocument() { var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; var resolved = resolveDocumentPickerOptions(options); return native("getDocument").getDocument(resolved).then(toResult, rethrowNativeError); } var DocumentPicker = Object.freeze({ getDocument }); export { DocumentPicker }; //# sourceMappingURL=index.native.js.map