import { type ReactNode } from 'react'; import { KeyboardAvoidingView, Modal, Platform, Pressable, View } from 'react-native'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; import { IconButton } from '../../atoms/IconButton'; import { Text } from '../../atoms/Text'; import { cn } from '../../lib/cn'; interface DrawerProps { visible: boolean; onClose: () => void; title?: string; children: ReactNode; /** * Altura máxima en porcentaje (`'90%'`) o `'100%'` para drawer fullscreen. */ maxHeight?: string | number; className?: string; contentClassName?: string; } export function Drawer({ visible, onClose, title, children, maxHeight = '90%', className, contentClassName, }: DrawerProps) { const insets = useSafeAreaInsets(); const isFullScreen = maxHeight === '100%' || maxHeight === '100' || maxHeight === 100; const heightStyle = isFullScreen ? { flex: 1 as const } : { height: typeof maxHeight === 'number' ? maxHeight : (maxHeight as `${number}%`) }; return ( {title ? ( {title} ) : null} {children} ); }