Components

Modal

Flexible modal dialog with preset types, header/footer configurations, and position options.

iOSAndroid
Preview Modal on your device

Scan with Expo Go

Download Expo Go, then scan the QR code to preview native components.

Installation

pnpm dlx @docyrus/cli add @docyrus/rn-modal
Required Packages(1 package)
pnpm add react-native-reanimated

Usage

import { Modal } from '@/components/docyrus-native/modal';

<Modal
  visible={isOpen}
  onClose={() => setIsOpen(false)}
  title="Settings"
  modalType="default"
>
  <Text>Modal content goes here.</Text>
</Modal>

API Reference

PropTypeDefaultDescription
visibleboolean—Whether the modal is visible
onClose() => void—Close handler
onConfirm() => void—Confirm handler (for confirm/picker types)
titlestring—Modal title
closeOnOverlayPressboolean—Close on backdrop tap (auto-configured by modalType)
size'sm' | 'md' | 'lg' | 'full''md'Modal width/height size
position'center' | 'bottom''center'Modal position on screen
variant'default' | 'elevated' | 'bordered''default'Visual variant
backdropOpacitynumber0.4Backdrop opacity (0 to 1)
modalType'default' | 'info' | 'confirm' | 'picker' | 'custom''default'Preset type (auto-configures header/footer)
headerType'none' | 'title-close' | 'title-actions'—Header layout (auto-set by modalType unless custom)
footerType'none' | 'actions'—Footer layout (auto-set by modalType unless custom)
confirmTextstring'Confirm'Confirm button label
cancelTextstring'Cancel'Cancel button label
headerReactNode—Custom header element
footerReactNode—Custom footer element
childrenReactNode—Modal body content
classNamestring—Additional CSS classes
backdropClassNamestring—Backdrop CSS classes
contentClassNamestring—Content area CSS classes
headerClassNamestring—Header CSS classes
titleClassNamestring—Title text CSS classes
footerClassNamestring—Footer CSS classes
accessibilityLabelstring—Accessibility label for the modal
TypeHeaderFooterClose on overlay
default / infotitle-close (if title set)noneyes
confirmnoneactionsno
pickertitle-actionsnoneyes
customconfigurableconfigurableyes

Translation Keys

Built-in copy is read through useUiTranslation() — provide these keys via <UiTranslationProvider>. Without a provider the English fallback is shown.

KeyEnglish fallbackUsed for
ui.modal.confirmConfirmConfirm button (confirmText prop wins)
ui.common.cancelCancelCancel button (cancelText prop wins)
ui.modal.doneDoneDone button of the picker modal

Type Exports

TypeDescription
ModalPropsProps for Modal component
ModalType'default' | 'info' | 'confirm' | 'picker' | 'custom'
ModalHeaderType'none' | 'title-close' | 'title-actions'
ModalFooterType'none' | 'actions'
ModalSize'sm' | 'md' | 'lg' | 'full'
ModalPosition'center' | 'bottom'
ModalVariant'default' | 'elevated' | 'bordered'

On this page