/** * DT Modal Component * * Wraps React Native Paper's Modal + Portal with the Dangerous Things * aesthetic. Content is rendered inside a DTCard for the beveled look. * * Web CSS reference (Modal.tsx): * - Centered overlay with dark backdrop * - Content in beveled card container */ import {StyleSheet, ViewStyle, StyleProp, KeyboardAvoidingView, Platform} from 'react-native'; import {Portal, Modal} from 'react-native-paper'; import {useDTTheme} from '../theme/DTThemeProvider'; import {type DTVariant} from '../utils/variantColors'; import {DTCard} from './DTCard'; interface DTModalProps { /** * Whether the modal is visible */ visible: boolean; /** * Called when the modal is dismissed */ onDismiss: () => void; /** * Optional title for the modal header */ title?: string; /** * Visual variant * @default 'normal' */ variant?: DTVariant; /** * Modal content */ children: React.ReactNode; /** * Whether the modal can be dismissed by tapping the backdrop * @default true */ dismissable?: boolean; /** * Additional styles for the card content area */ contentStyle?: StyleProp; /** * Additional styles for the modal container */ style?: StyleProp; } /** * DT-styled Modal wrapping React Native Paper Modal + Portal * * @example * setShowModal(false)} title="Confirm"> * Are you sure? * * * @example * * Something went wrong * */ export function DTModal({ visible, onDismiss, title, variant = 'normal', children, dismissable = true, contentStyle, style, }: DTModalProps) { const theme = useDTTheme(); return ( {children} ); } const styles = StyleSheet.create({ modal: {}, container: { marginHorizontal: 24, }, keyboardAvoid: { width: '100%', }, });