import React from 'react'; import { Modal, View, Text, TouchableOpacity, StyleSheet, Pressable, ActivityIndicator, } from 'react-native'; import colors from '../Color'; type ConfirmDialogProps = { visible: boolean; title?: string; message: string; confirmText?: string; cancelText?: string; onConfirm: () => void; onClose: () => void; loading:boolean }; const ConfirmDialog: React.FC = ({ visible, title = 'Confirm', message, confirmText = 'Confirm', cancelText = 'Cancel', onConfirm, onClose, loading, }) => { return ( {/* Overlay (click to close) */} {/* Stop propagation */} {/* Title */} {title} {/* Message */} {message} {/* Actions */} {cancelText} { onConfirm(); onClose(); }} > { !loading ?{confirmText}:} ); }; export default ConfirmDialog; const styles = StyleSheet.create({ overlay: { flex: 1, backgroundColor: 'rgba(0,0,0,0.5)', justifyContent: 'center', alignItems: 'center', }, container: { width: '85%', backgroundColor: '#fff', borderRadius: 12, padding: 20, elevation: 5, }, title: { fontSize: 18, fontWeight: '600', marginBottom: 8, textAlign: 'center', }, message: { fontSize: 15, color: '#444', textAlign: 'center', marginBottom: 20, }, actions: { flexDirection: 'row', justifyContent: 'flex-end', }, cancelBtn: { paddingVertical: 10, paddingHorizontal: 16, marginRight: 10, }, cancelText: { fontSize: 14, color: '#666', }, confirmBtn: { backgroundColor: colors.primary, paddingVertical: 10, paddingHorizontal: 18, borderRadius: 10, }, confirmText: { color: '#fff', fontSize: 14, fontWeight: '500', }, });