UNPKG

@crossed/primitive

Version:

A universal & performant styling library for React Native, Next.js & React

17 lines (16 loc) 698 B
import { jsx } from "react/jsx-runtime"; import { forwardRef, Fragment } from "react"; import { Provider, useContext } from "./context"; import { RemoveScroll as RS } from "../utils"; const createDropdownPortal = (Styled) => forwardRef( ({ removeParentScroll = true, ...props }, ref) => { const { children, ...otherProps } = props; const context = useContext(); const RemoveScroll = removeParentScroll ? RS : Fragment; return /* @__PURE__ */ jsx(Styled, { ...otherProps, ref, children: /* @__PURE__ */ jsx(Provider, { ...context, children: /* @__PURE__ */ jsx(RemoveScroll, { children }) }) }); } ); export { createDropdownPortal }; //# sourceMappingURL=DropdownPortal.js.map