import { Ionicons } from '@expo/vector-icons' import React, { type ReactNode } from 'react' import Block from './Block' import Text from './Text' import Toast from './Toast' interface ConfirmModalProps { /** 标题,默认为 "确认支付?" */ title?: string /** 徽标文字,默认为 "SYSTEM_MSG" */ badge?: string /** 内容,可以是字符串或React节点 */ content?: ReactNode /** 确认按钮文字,默认为 "确认" */ confirmText?: string /** 取消按钮文字,默认为 "取消" */ cancelText?: string /** 确认回调 */ onConfirm?: () => void /** 取消回调,如果不传则默认关闭Modal */ onCancel?: () => void } const ConfirmModal: React.FC = ({ title = '确认支付?', badge = 'SYSTEM_MSG', content, confirmText = '确认', cancelText = '取消', onConfirm, onCancel, }) => { const handleCancel = () => { if (onCancel) { onCancel() } else { Toast.hideModal() } } const handleConfirm = () => { onConfirm && onConfirm() } return ( {badge} {title} {typeof content === 'string' ? ( {content} ) : ( content )} {cancelText} {confirmText} ) } export default ConfirmModal