import React, { useEffect, useState } from 'react'; import { Animated, Modal, Pressable, StyleSheet, View } from 'react-native'; import { Button } from '@/components/ui/Button'; import { Text } from '@/components/ui/Text'; import { BorderRadius, Colors, Spacing, Shadows, Typography, } from '@/constants/theme'; interface ConfirmModalProps { visible: boolean; title: string; message?: string; detail?: string; confirmLabel?: string; cancelLabel?: string; destructive?: boolean; loading?: boolean; onConfirm: () => void; onCancel: () => void; testID?: string; } export const ConfirmModal: React.FC = ({ visible, title, message, detail, confirmLabel = 'Confirmar', cancelLabel = 'Cancelar', destructive = false, loading = false, onConfirm, onCancel, testID = 'confirm-modal', }) => { const [fade] = useState(() => new Animated.Value(0)); useEffect(() => { if (visible) { fade.setValue(0); Animated.timing(fade, { toValue: 1, duration: 180, useNativeDriver: true, }).start(); } }, [visible, fade]); const dismiss = () => { if (!loading) { onCancel(); } }; return ( {title} {message ? {message} : null} {detail ? ( {detail} ) : null}