@atlaskit/portal
Version:
A wrapper for rendering components in React portals.
22 lines • 900 B
JavaScript
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',
isClosed = false
}) {
const isSubsequentRender = useIsSubsequentRender(mountStrategy);
useFirePortalEvent(zIndex);
return !fg('platform_design_system_team_portal_logic_r18_fix') ? isSubsequentRender ? /*#__PURE__*/React.createElement(InternalPortal, {
zIndex: zIndex,
isClosed: isClosed
}, children) : null : /*#__PURE__*/React.createElement(InternalPortalNew, {
zIndex: zIndex,
isClosed: isClosed
}, children);
}