import { Ionicons } from '@expo/vector-icons'; import { useRouter } from 'expo-router'; import { Pressable, ScrollView, StyleSheet, Text, View } from 'react-native'; import { SafeAreaView } from 'react-native-safe-area-context'; import { useState } from 'react'; import { useLegalData } from '../../src/hooks'; import { LoadingState, ErrorState, EmptyState } from '../../src/components/StateView'; import { colors } from '../../src/theme'; import type { LegalFAQ } from '../../src/types'; /* ===================== 顶部导航 ===================== */ function Header({ onBack }: { onBack: () => void }) { return ( 常见问题 ); } /* ===================== FAQ 项 ===================== */ function FAQItem({ faq }: { faq: LegalFAQ }) { const [expanded, setExpanded] = useState(false); return ( setExpanded((v) => !v)}> {faq.question} {expanded && {faq.answer}} ); } /* ===================== 页面 ===================== */ export default function LegalFaqScreen() { const router = useRouter(); const { faqs, loading, error, refresh } = useLegalData(); return (
router.back()} /> {loading ? ( ) : error ? ( ) : faqs.length === 0 ? ( ) : ( {faqs.map((faq) => ( ))} )} ); } const styles = StyleSheet.create({ safeArea: { flex: 1, backgroundColor: colors.pageBg, }, header: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', paddingHorizontal: 8, height: 48, backgroundColor: colors.white, borderBottomWidth: 1, borderBottomColor: colors.borderLight, }, headerBtn: { width: 40, height: 40, alignItems: 'center', justifyContent: 'center', }, headerTitle: { fontSize: 17, fontWeight: '700', color: colors.textPrimary, }, scroll: { flex: 1, }, content: { padding: 8, paddingBottom: 24, }, faqCard: { backgroundColor: colors.white, borderRadius: 8, paddingHorizontal: 8, }, faqItem: { paddingVertical: 12, borderBottomWidth: 1, borderBottomColor: colors.borderLight, }, faqRow: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', }, faqQ: { flex: 1, fontSize: 14, fontWeight: '600', color: colors.textPrimary, marginRight: 8, }, faqA: { marginTop: 8, fontSize: 13, lineHeight: 19, color: colors.textSecondary, }, });