React Native Mantine › Overlays
Affix
Render content at a fixed position via portal
Import: import { Affix } from 'react-native-mantine';
Usage
import { Affix, PortalProvider } from 'react-native-mantine';
// Wrap your app once to enable portal rendering
<PortalProvider>
<App />
</PortalProvider>
// Pinned to the bottom-right corner of the screen
<Affix position={{ bottom: 20, right: 20 }}>
<Button onPress={scrollToTop}>Scroll to top</Button>
</Affix>
// Position relative to the parent instead of the overlay
<Affix withinPortal={false} position={{ top: 12, left: 12 }}>
<Badge>Pinned</Badge>
</Affix>
Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | Affix content | |
position | { top?: number | string; left?: number | string; bottom?: number | string; right?: number | string } | { bottom: 0, right: 0 } | Fixed position on the screen |
zIndex | number | 300 | zIndex of the root element |
withinPortal | boolean | true | Determines whether the affix should render inside the PortalProvider overlay |
portalTarget | string | Name of the PortalHost to render into |