one
Version:
One is a React framework for web, iOS, and Android apps.
47 lines (44 loc) • 1.52 kB
JavaScript
import { Children, isValidElement } from "react";
import { DomView } from "./web/DomView.mjs";
import { jsx, jsxs } from "react/jsx-runtime";
function ArrangementPrimary(_props) {
throw new Error("Swift.ArrangementView.Primary must be a direct child of Swift.ArrangementView");
}
function ArrangementSecondary(_props) {
throw new Error("Swift.ArrangementView.Secondary must be a direct child of Swift.ArrangementView");
}
function ArrangementViewComponent({ children, primary, secondary, leading, detail, style, testID }) {
let primaryNode = primary ?? leading;
let secondaryNode = secondary ?? detail;
Children.forEach(children, (child) => {
if (!isValidElement(child)) return;
if (child.type === ArrangementPrimary) {
primaryNode = child.props.children;
} else if (child.type === ArrangementSecondary) {
secondaryNode = child.props.children;
}
});
return /* @__PURE__ */ jsxs(DomView, {
testID,
baseStyle: {
flex: 1,
flexDirection: "row"
},
style,
children: [/* @__PURE__ */ jsx(DomView, {
baseStyle: { flex: 1 },
children: primaryNode
}), /* @__PURE__ */ jsx(DomView, {
baseStyle: { flex: 1 },
children: secondaryNode
})]
});
}
const ArrangementView = Object.assign(ArrangementViewComponent, {
Primary: ArrangementPrimary,
Secondary: ArrangementSecondary,
Leading: ArrangementPrimary,
Detail: ArrangementSecondary
});
export { ArrangementPrimary, ArrangementSecondary, ArrangementView, ArrangementViewComponent };
//# sourceMappingURL=ArrangementView.mjs.map