UNPKG

@atlaskit/portal

Version:

A wrapper for rendering components in React portals.

19 lines 832 B
import React from 'react'; import { fg } from '@atlaskit/platform-feature-flags'; import InternalPortal from './internal/components/internal-portal'; import InternalPortalNew from './internal/components/internal-portal-new'; import useIsSubsequentRender from './internal/hooks/use-is-subsequent-render'; import useFirePortalEvent from './internal/hooks/use-portal-event'; export default function Portal({ zIndex = 0, children, mountStrategy = 'effect' }) { const isSubsequentRender = useIsSubsequentRender(mountStrategy); useFirePortalEvent(zIndex); return !fg('platform_design_system_team_portal_logic_r18_fix') ? isSubsequentRender ? /*#__PURE__*/React.createElement(InternalPortal, { zIndex: zIndex }, children) : null : /*#__PURE__*/React.createElement(InternalPortalNew, { zIndex: zIndex }, children); }