
One.UI.Portal renders its children inside a One.UI.PortalHost somewhere
else in the app. The children stay in their place in the React tree.
react-native-teleport.Mount a host where the content should appear, then name it from a portal. The host draws portals above its own children.
import { One } from 'one'import { StyleSheet, View } from 'react-native'
export function Screen() { return ( <View style={{ flex: 1 }}> <MessageList /> <One.UI.PortalHost name="overlay" style={StyleSheet.absoluteFill} /> </View> )}
function MessageRow({ menuOpen }: { menuOpen: boolean }) { return ( <View style={{ overflow: 'hidden' }}> <RowContent /> {menuOpen && ( <One.UI.Portal hostName="overlay" name="menu"> <RowMenu /> </One.UI.Portal> )} </View> )}The menu escapes the row’s clip because it renders in the host, yet it still reads the row’s context and state.
Portal also accepts React Native ViewProps, applied to the view that wraps
its children.
| Props | Type | Description |
|---|---|---|
children (required)ReactNodeThe content to move. | ReactNode | The content to move. |
hostNamestringThe host to render in. Without it, children render in place. | string | The host to render in. Without it, children render in place. |
namestringA later portal with the same name in the same host replaces this one. | string | A later portal with the same name in the same host replaces this one. |
PortalHost also accepts React Native ViewProps. style sizes the host.
| Props | Type | Description |
|---|---|---|
name (required)stringThe name portals use as their hostName. | string | The name portals use as their hostName. |
childrenReactNodeThe host's own content, drawn below its portals. | ReactNode | The host's own content, drawn below its portals. |
hostName moves the same children, with their state, to the new host.| iOS | Android | Web | |
|---|---|---|---|
| Host | Fabric view | Native view group | Stable DOM container |
| Layout | Host size measured natively, no JS round trip | Same | CSS |
Replace imports from react-native-teleport with One.UI.Portal and
One.UI.PortalHost, remove PortalProvider, and mount any root overlay host
yourself. @tamagui/native/setup-teleport keeps its import path and binds
Tamagui portals to these components.
Edit this page on GitHub.