按设计稿修改,中英文,ios图标问题,statusbar等

This commit is contained in:
Caiyanpeng committed 2025-12-25 16:16:01 +08:00
1 parent b6e6905d05
commit 5462cf5abe
37 files changed
+1641 -975

No files matched your search

+17 -7
View File
@@ -17,8 +17,11 @@ import { NativeStackScreenProps } from "@react-navigation/native-stack";
import { RootStackParamList } from "../App";
import Icon from "react-native-vector-icons/MaterialCommunityIcons"; // 信号图标集
type Props = NativeStackScreenProps<RootStackParamList, "Scan">;
type Props = NativeStackScreenProps<RootStackParamList>;
type DeviceWithTimestamp = ScannedPeripheral & { lastSeen: number };
import { useTranslation } from 'react-i18next';
import MyStatusbar from "./component/MyStatusbar";
import MyHeader from "./component/MyHeader";
export default function ScanScreen({ navigation }: Props) {
const [devices, setDevices] = useState<DeviceWithTimestamp[]>([]);
@@ -26,7 +29,7 @@ export default function ScanScreen({ navigation }: Props) {
const [refreshing, setRefreshing] = useState(false);
const handlerRef = useRef<((payload: CentralEventMap["scannedPeripheral"]) => void) | null>(null);
const { t } = useTranslation();
// 将 RSSI 转换为信号格数(0-4)
const getSignalLevel = (rssi?: number): number => {
if (rssi === undefined) return 0;
@@ -154,6 +157,13 @@ export default function ScanScreen({ navigation }: Props) {
return (
<View style={styles.container}>
<MyStatusbar backgroundColor="#f2f3f7" dark></MyStatusbar>
<MyHeader
title={t('scan.title')}
textColor="#333"
backgroundColor="#f2f3f7"
navigation={navigation}
></MyHeader>
<FlatList
data={devices}
keyExtractor={(item) => item.systemId}
@@ -163,7 +173,7 @@ export default function ScanScreen({ navigation }: Props) {
style={styles.deviceRow}
>
<View style={styles.deviceInfo}>
<Text style={styles.deviceName}>{item.name || "[no name]"}</Text>
<Text style={styles.deviceName}>{item.name || t("scan.noName")}</Text>
<View style={styles.rssiRow}>
{renderSignalIcon(item.advertisementData?.rssi)}
<Text style={styles.rssiText}>
@@ -177,13 +187,13 @@ export default function ScanScreen({ navigation }: Props) {
<View style={styles.emptyBox}>
{scanning ? (
<>
<Text style={styles.emptyText}>搜索中...</Text>
<Text style={styles.tips}>(请确保设备有电且被唤醒)</Text>
<Text style={styles.emptyText}>{t("scan.scanning")}</Text>
<Text style={styles.tips}>{t("scan.tipScanning")}</Text>
</>
) : (
<>
<Text style={styles.emptyText}>暂无设备</Text>
<Text style={styles.tips}>(请在设置中打开蓝牙)</Text>
<Text style={styles.emptyText}>{t("scan.noDevice")}</Text>
<Text style={styles.tips}>{t("scan.tipBluetooth")}</Text>
</>
)}
</View>