import { Ionicons } from '@expo/vector-icons'; import { useRouter, useLocalSearchParams } from 'expo-router'; import { Pressable, ScrollView, StyleSheet, Text, View } from 'react-native'; import { SafeAreaView } from 'react-native-safe-area-context'; import { useLegalData } from '../../src/hooks'; import { LoadingState, ErrorState, EmptyState } from '../../src/components/StateView'; import { colors } from '../../src/theme'; /* ===================== 顶部导航 ===================== */ function Header({ onBack }: { onBack: () => void }) { return ( 文书预览 ); } /* ===================== 页面 ===================== */ export default function LegalTemplateScreen() { const router = useRouter(); const { id } = useLocalSearchParams(); const { templates, loading, error, refresh } = useLegalData(); const templateId = Array.isArray(id) ? id[0] : id; const template = templateId ? templates.find((t) => t.id === templateId) : undefined; return (
router.back()} /> {loading ? ( ) : error ? ( ) : !template ? ( ) : ( {template.name} {template.description} {/* selectable:长按正文即可复制,无需额外原生模块(mock 阶段) */} {template.content} 长按正文即可复制;正式下载 / 导出为 Word·PDF 需后端文件支持,当前为内容预览。 )} ); } 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: 12, paddingBottom: 24, }, headCard: { flexDirection: 'row', alignItems: 'center', padding: 16, borderRadius: 12, backgroundColor: colors.white, marginBottom: 12, }, headBody: { flex: 1, marginLeft: 12, }, name: { fontSize: 16, fontWeight: '700', color: colors.textPrimary, }, desc: { marginTop: 2, fontSize: 12, color: colors.textSecondary, }, contentCard: { padding: 16, borderRadius: 12, backgroundColor: colors.white, borderWidth: 1, borderColor: colors.borderLight, }, contentText: { fontSize: 14, lineHeight: 22, color: colors.textPrimary, }, tip: { marginTop: 12, fontSize: 12, color: colors.textHint, lineHeight: 18, }, });