import { View, Text, ScrollView, Pressable, Image, useWindowDimensions, ActivityIndicator } from 'react-native'; import React, { useContext, useEffect, useState } from 'react'; import { SafeAreaView } from 'react-native-safe-area-context'; import { router } from 'expo-router'; import { CrossLogoSvg, RightArrowIconSvg } from '../global/SVG'; import { walletService } from '../../service/walletService'; import { useTranslation } from '../../util/hooks/useTranslation'; const VipQrPageComponent = () => { const { t } = useTranslation(); // 使用翻译钩子 const { width } = useWindowDimensions(); const qrCodeSize = width * 0.8; // 80% of screen width const [loading, setLoading] = useState(true); const [transactions, setTransactions] = useState([]); useEffect(() => { const fetchTransactionRecords = async () => { try { setLoading(true); const response = await walletService.getTransactionRecord(); if (response && Array.isArray(response)) { setTransactions(response); } else { setTransactions([]); } } catch (error) { console.error(t('vipQr.error_fetching_transactions'), error); setTransactions([]); } finally { setLoading(false); } }; fetchTransactionRecords(); }, []); return ( { router.replace('/mainPage'); }} > {t('vipQr.title')} {loading ? ( {t('vipQr.loading')} ) : transactions.length > 0 ? ( {t('vipQr.scan_instructions')} ) : ( {t('vipQr.no_transactions_message')} )} ); }; export default VipQrPageComponent;