UNPKG

one

Version:

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

55 lines (52 loc) • 2.32 kB
import { jsx, jsxs } from "react/jsx-runtime"; import { Platform } from "react-native"; import { InsideContainer, assertOneNativeChildren } from "./Containers.native.js"; import { useControlled } from "./controlled.native.js"; import { assertSwiftUIValue } from "./generated/swiftui.native.js"; import NativeContent from "./specs/OneNativePopoverContentNativeComponent.native.js"; import NativePopover from "./specs/OneNativePopoverNativeComponent.native.js"; function Popover(param) { var { isPresented, onIsPresentedChange, revision = 0, arrowEdge, presentationCompactAdaptation = "automatic", contentWidth, contentHeight, content, children, style, ...props } = param; if (typeof isPresented !== "boolean") throw new Error("Swift.Popover isPresented must be a boolean"); if (!Number.isFinite(contentWidth) || contentWidth <= 0) throw new Error("Swift.Popover contentWidth must be a positive number"); if (!Number.isFinite(contentHeight) || contentHeight <= 0) throw new Error("Swift.Popover contentHeight must be a positive number"); var iosVersion = Number.parseFloat(String(Platform.Version)); if (arrowEdge !== void 0) assertSwiftUIValue("Edge", arrowEdge, iosVersion); assertSwiftUIValue("PresentationAdaptation", presentationCompactAdaptation, iosVersion); assertOneNativeChildren(children, "Swift.Popover"); var controlled = useControlled(function(event) { return onIsPresentedChange(event.isPresented); }, revision); return /* @__PURE__ */ jsxs(NativePopover, { ...props, style: [{ alignSelf: "stretch" }, style], isPresented, revision, acknowledgedEvent: controlled.acknowledgedEvent, arrowEdge: arrowEdge !== null && arrowEdge !== void 0 ? arrowEdge : "", presentationCompactAdaptation, contentWidth, contentHeight, onNativePopoverIsPresentedChange: function onNativePopoverIsPresentedChange(param2) { var { nativeEvent } = param2; return controlled.onNativeChange(nativeEvent); }, children: [/* @__PURE__ */ jsx(InsideContainer, { value: true, children }), /* @__PURE__ */ jsx(NativeContent, { collapsable: false, style: { position: "absolute", left: 0, top: 0 }, children: /* @__PURE__ */ jsx(InsideContainer, { value: false, children: content }) })] }); } export { Popover }; //# sourceMappingURL=Popover.native.js.map