React Native MantineOverlays

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

PropTypeDefaultDescription
childrenReactNodeAffix content
position{ top?: number | string; left?: number | string; bottom?: number | string; right?: number | string }{ bottom: 0, right: 0 }Fixed position on the screen
zIndexnumber300zIndex of the root element
withinPortalbooleantrueDetermines whether the affix should render inside the PortalProvider overlay
portalTargetstringName of the PortalHost to render into

Source on GitHub · npm