powerfun-setting/src/HomeScreen.tsx

89 lines
2.9 KiB
TypeScript
Raw Normal View History

2025-11-05 15:18:15 +08:00
import React from "react";
import { View, Text, TouchableOpacity, StyleSheet, StatusBar, Image } from "react-native";
import { NativeStackScreenProps,NativeStackNavigationProp } from "@react-navigation/native-stack";
2025-11-05 15:18:15 +08:00
import { RootStackParamList } from "../App";
import MyStatusbar from "./component/MyStatusbar";
import MyHeader from "./component/MyHeader";
import pxToDp from "./helper/pxToDp";
import DeviceInfo from "react-native-device-info";
import { useTranslation } from 'react-i18next';
2025-11-05 15:18:15 +08:00
type Props = NativeStackScreenProps<RootStackParamList>;
2025-11-05 15:18:15 +08:00
export default function HomeScreen({ navigation }: Props) {
const { t } = useTranslation();
2025-11-05 15:18:15 +08:00
return (
<View style={styles.container}>
{/* 设置状态栏颜色 */}
<MyStatusbar backgroundColor="#E7141E" dark={false}></MyStatusbar>
<MyHeader title={t('home.title')} textColor="#fff" backgroundColor="#E7141E" hideBack navigation={navigation}
rightView={<TouchableOpacity style={{width:pxToDp(56),height:pxToDp(56),alignItems:'center',justifyContent:'center'}}
onPress={() => navigation.navigate("Setting")}>
<Image source={require('./img/Settings.png')} style={{width:pxToDp(48),height:pxToDp(44)}}></Image>
</TouchableOpacity>}></MyHeader>
2025-11-05 15:18:15 +08:00
{/* 中间按钮 */}
<View style={styles.centerBox}>
<Image source={require("./img/Search.png")} style={{width:pxToDp(568),height:pxToDp(344),marginBottom:pxToDp(100)}}></Image>
2025-11-05 15:18:15 +08:00
<TouchableOpacity
style={styles.button}
onPress={() => navigation.navigate("Scan")}
>
<Text style={styles.buttonText}>{t("home.powerMeter")}</Text>
</TouchableOpacity>
<TouchableOpacity
style={[styles.button, { marginTop: pxToDp(20) }]}
onPress={() => navigation.navigate("ScanScreen2")}
>
<Text style={styles.buttonText}>{t("home.paddle")}</Text>
</TouchableOpacity>
<TouchableOpacity
style={[styles.button, { marginTop: pxToDp(20) }]}
onPress={() => navigation.navigate("ScanScreen3")}
>
<Text style={styles.buttonText}>{t("home.T5trainer")}</Text>
2025-11-05 15:18:15 +08:00
</TouchableOpacity>
</View>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
},
centerBox: {
flex: 1,
// justifyContent: "center",
2025-11-05 15:18:15 +08:00
alignItems: "center",
backgroundColor:'#fff',
paddingTop:pxToDp(250)
2025-11-05 15:18:15 +08:00
},
button: {
backgroundColor: "#E7141E",
borderRadius: pxToDp(24),
width:pxToDp(300),
height:pxToDp(96),
alignItems:'center',
justifyContent:'center'
2025-11-05 15:18:15 +08:00
},
buttonText: {
color: "#fff",
fontSize: pxToDp(32),
2025-11-05 15:18:15 +08:00
fontWeight: "bold",
},
bottomBox: {
alignItems: "center",
marginBottom: 20,
},
privacyText: {
fontSize: 16,
color: "#E7141E", // 红色字体
marginBottom: 8,
},
version: {
fontSize: 14,
color: "#999",
},
});