UNPKG

one

Version:

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

63 lines (61 loc) • 2.56 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 mapControls_native_exports = {}; __export(mapControls_native_exports, { Map: () => Map }); module.exports = __toCommonJS(mapControls_native_exports); var import_jsx_runtime = require("react/jsx-runtime"); var import_react = require("react"); var import_Controls = require("./generated/Controls.native.js"); var import_containerChildren = require("./containerChildren.native.js"); var accepted = "One.iOS.MapCompass, One.iOS.MapPitchToggle, or One.iOS.MapUserLocationButton"; function Map(param) { var { children, ...props } = param; if (children !== void 0) { (0, import_containerChildren.assertOneNativeChildren)(children, "One.iOS.Map"); var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0; try { for (var _iterator = import_react.Children.toArray(children)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var child = _step.value; if (child === null || child === void 0 || typeof child === "boolean") continue; if (!/* @__PURE__ */ (0, import_react.isValidElement)(child) || child.type !== import_Controls.MapCompass && child.type !== import_Controls.MapPitchToggle && child.type !== import_Controls.MapUserLocationButton) throw new Error(`One.iOS.Map accepts ${accepted} elements as direct children`); } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return != null) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } } var NativeMap = import_Controls.Map; return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NativeMap, { ...props, children }); }