one
Version:
One is a new React Framework that makes Vite serve both native and web.
32 lines (30 loc) • 893 B
JavaScript
import React from "react";
function _type_of(obj) {
"@swc/helpers - typeof";
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
}
var Decorated = Symbol();
var withStaticProperties = function (component, staticProps) {
var next = function () {
if (component[Decorated]) {
var _ = React.forwardRef(function (props, ref) {
return React.createElement(component, {
...props,
ref
});
});
for (var key in component) {
var v = component[key];
_[key] = v && (typeof v === "undefined" ? "undefined" : _type_of(v)) === "object" ? {
...v
} : v;
}
}
return component;
}();
Object.assign(next, staticProps);
next[Decorated] = true;
return next;
};
export { withStaticProperties };
//# sourceMappingURL=withStaticProperties.native.js.map