import { View } from '@tamagui/core' import { getPortal, NativePortal } from '@tamagui/native' import { useStackedZIndex } from '@tamagui/z-index-stack' import { GorhomPortalItem } from './GorhomPortalItem' import { getStackedZIndexProps } from './helpers' import type { PortalProps } from './PortalProps' export const Portal = (propsIn: PortalProps) => { const zIndex = useStackedZIndex(getStackedZIndexProps(propsIn)) const { children, passThrough } = propsIn const contents = ( {children} ) const portalState = getPortal().state // use teleport if available (best option - preserves context) if (portalState.type === 'teleport') { return {contents} } // fall back to Gorhom portal system (JS-based, needs context re-propagation) return ( {contents} ) }