import React, { useState } from "react"; import { View, Text, ScrollView, StyleSheet, TouchableOpacity, Image } from "react-native"; import { useTranslation } from 'react-i18next'; import MyStatusbar from "./component/MyStatusbar"; import MyHeader from "./component/MyHeader"; import LanguageModal from "./component/LanguageModal.tsx"; import { NativeStackScreenProps } from "@react-navigation/native-stack"; import { RootStackParamList } from "../App"; import pxToDp from "./helper/pxToDp"; import DeviceInfo from "react-native-device-info"; import { LANGUAGES } from "./i18n"; type Props = NativeStackScreenProps; export default function SettingScreen({ navigation }: Props) { const { t, i18n } = useTranslation(); const [languageModalVisible, setLanguageModalVisible] = useState(false); // 获取当前语言显示名称 const getCurrentLanguageLabel = (): string => { const currentLang = i18n.language; const language = LANGUAGES.find(lang => lang.key === currentLang); return language?.label || '中文'; }; return ( {/* 软件语言 */} setLanguageModalVisible(true)} > {t('settings.language')} {getCurrentLanguageLabel()} {/* 隐私协议 */} navigation.navigate("Privacy")} > {t('settings.privacy')} {/* 版本号 */} {t('settings.version')} {DeviceInfo.getVersion()} {/* 语言切换弹窗 */} setLanguageModalVisible(false)} /> ); } const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: "#f2f3f7", }, settingItem: { width: pxToDp(670), height: pxToDp(108), borderRadius: pxToDp(24), backgroundColor: '#fff', flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', paddingHorizontal: pxToDp(32), }, settingItemLeft: { flexDirection: 'row', alignItems: 'center', }, settingItemRight: { flexDirection: 'row', alignItems: 'center', }, icon: { width: pxToDp(40), height: pxToDp(40), marginRight: pxToDp(12), }, settingLabel: { fontSize: pxToDp(30), color: '#333', }, settingValue: { fontSize: pxToDp(30), color: "#999", marginRight: pxToDp(14), }, arrow: { width: pxToDp(14), height: pxToDp(24), }, });