import React, { useState } from 'react'; import { ScrollView, Text, View, Alert } from 'react-native'; import { Space, Button, Notification, Size, Fill } from '@xrnjs/ui'; import Card from '_global/Card'; import styles from './style'; const InteractiveUsage: React.FC = () => { const [callbackVisible, setCallbackVisible] = useState(false); const [actionVisible, setActionVisible] = useState(false); const showCallbackNotification = () => { Notification.info({ title: '回调示例', description: '关闭这个通知时会触发回调函数', }).then(() => { Alert.alert('提示', '通知已关闭'); }); }; const showActionNotification = () => { setActionVisible(true); }; const handleWeakPress = async () => { Alert.alert('提示', '点击了次要按钮'); }; const handleSolidPress = async () => { Alert.alert('提示', '点击了主要按钮'); }; const showComplexNotification = () => { Notification.warning({ title: '确认操作', description: '您确定要删除这个项目吗?此操作不可撤销', duration: 0, btn: ( ), }); }; return ( 演示通知的各种交互功能,包括回调函数和自定义按钮事件 {/* 带回调的通知 */} console.log('开始关闭')} onClosed={() => { console.log('关闭完成'); setCallbackVisible(false); }} onRequestClose={() => console.log('请求关闭')} /> {/* 带按钮事件的通知 */} setActionVisible(false)} btn={ } /> ); }; export default InteractiveUsage;