React Native MantineOverlays

Modal

Full-featured modal dialog

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

Usage

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

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

  return (
    <>
      <Button onPress={() => setOpened(true)}>
        Open Modal
      </Button>

      <Modal
        opened={opened}
        onClose={() => setOpened(false)}
        title="My Modal"
      >
        <Text>Modal content goes here</Text>
      </Modal>
    </>
  );
};

Props

PropTypeDefaultDescription
opened (required)booleanModal opened state
onClose (required)() => voidCalled when modal is closed
titleReact.ReactNodeModal title
childrenReact.ReactNodeModal content
sizeMantineNumberSize | 'full''md'Modal size
paddingSpacingValue'md'Modal padding
radiusMantineNumberSize'md'Modal border radius
closeOnClickOutsidebooleantrueIf true, pressing the overlay closes the modal
centeredbooleanfalseIf true, modal will be centered on screen
withOverlaybooleantrueIf true, modal will show overlay
overlayOpacitynumber0.6Overlay opacity
overlayColorstring'#000'Overlay color
withCloseButtonbooleantrueIf true, close button will be shown
fullScreenbooleanfalseIf true, modal will take full screen
styleanyAdditional styles
transitionDurationnumber200Animation duration in ms
zIndexnumber1000Z-index
accessibilityLabelstringAccessibility label for the modal
testIDstringTest identifier used by testing frameworks

Source on GitHub · npm