one
Version:
One is a new React Framework that makes Vite serve both native and web.
26 lines (25 loc) • 783 B
JavaScript
import { Slot as RUISlot } from "@radix-ui/react-slot";
import { forwardRef, useMemo } from "react";
import { StyleSheet } from "react-native-web";
import { jsx } from "react/jsx-runtime";
function ShimSlotForReactNative(Component) {
return forwardRef(function RNSlotHOC({
style,
...props
}, ref) {
if (process.env.NODE_ENV !== "production") {
if (Array.isArray(style)) {
throw new Error("Slot does not support array styles. Use StyleSheet.flatten() or an object style instead.");
}
}
style = useMemo(() => StyleSheet.flatten(style), [style]);
return /* @__PURE__ */jsx(Component, {
ref,
...props,
style
});
});
}
const Slot = ShimSlotForReactNative(RUISlot);
export { Slot };
//# sourceMappingURL=Slot.mjs.map