one
Version:
One is a React framework for web, iOS, and Android apps.
71 lines (70 loc) • 2.63 kB
JavaScript
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 ArrangementView_exports = {};
__export(ArrangementView_exports, {
ArrangementPrimary: () => ArrangementPrimary,
ArrangementSecondary: () => ArrangementSecondary,
ArrangementView: () => ArrangementView,
ArrangementViewComponent: () => ArrangementViewComponent
});
module.exports = __toCommonJS(ArrangementView_exports);
var import_react = require("react");
var import_DomView = require("./web/DomView.cjs");
var import_jsx_runtime = require("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;
import_react.Children.forEach(children, (child) => {
if (!(0, import_react.isValidElement)(child)) return;
if (child.type === ArrangementPrimary) {
primaryNode = child.props.children;
} else if (child.type === ArrangementSecondary) {
secondaryNode = child.props.children;
}
});
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_DomView.DomView, {
testID,
baseStyle: {
flex: 1,
flexDirection: "row"
},
style,
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DomView.DomView, {
baseStyle: { flex: 1 },
children: primaryNode
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DomView.DomView, {
baseStyle: { flex: 1 },
children: secondaryNode
})]
});
}
const ArrangementView = Object.assign(ArrangementViewComponent, {
Primary: ArrangementPrimary,
Secondary: ArrangementSecondary,
Leading: ArrangementPrimary,
Detail: ArrangementSecondary
});