UNPKG

@nexara/nativeflow

Version:

Beautiful, responsive, and customizable UI components for React Native – built for performance and seamless experiences.

24 lines (23 loc) 528 B
"use strict"; import { useContext, useEffect } from "react"; import PortalContext from "./PortalContext.js"; const Portal = ({ children, name }) => { const { addComponent, removeComponent } = useContext(PortalContext); useEffect(() => { const uniqueId = name ?? `${Math.random() * 50}`; addComponent({ name: uniqueId, component: children }); return () => removeComponent(uniqueId); }, [children, name]); return null; }; export default Portal; //# sourceMappingURL=Portal.js.map