React Native MantineOverlays

Dialog

Lightweight floating dialog

Import: import { Dialog } from 'react-native-mantine';

Usage

import { useState } from 'react';
import { Dialog, Button, Text } from 'react-native-mantine';

const MyComponent = () => {
  const [opened, setOpened] = useState(false);

  return (
    <>
      <Button onPress={() => setOpened(true)}>
        Show Dialog
      </Button>

      {/* Positioned dialog */}
      <Dialog
        opened={opened}
        position={{ bottom: 20, right: 20 }}
      >
        <Text>Dialog content</Text>
        <Button onPress={() => setOpened(false)}>
          Close
        </Button>
      </Dialog>

      {/* Centered dialog */}
      <Dialog
        opened={opened}
        centered
      >
        <Text>Centered dialog content</Text>
      </Dialog>
    </>
  );
};

Props

PropTypeDefaultDescription
opened (required)booleanDialog opened state
childrenReact.ReactNodeDialog content
sizeMantineNumberSize | number'md'Dialog size
paddingSpacingValue'md'Dialog padding
radiusMantineNumberSize'md'Dialog border radius
position{ top?: number; left?: number; right?: number; bottom?: number; }Dialog position
centeredbooleanIf true, dialog will be centered on screen
withShadowbooleantrueIf true, dialog will show shadow
withBorderbooleanfalseIf true, dialog will show border
styleanyAdditional styles
transitionDurationnumber200Animation duration in ms
accessibilityLabelstringAccessibility label for the dialog
testIDstringTest identifier used by testing frameworks

Source on GitHub · npm