Compare commits

...

8 Commits
1.0.0 ... main

Author SHA1 Message Date
Caiyanpeng
d3d6774448 ios版本号,图标bug,苹果16顶部 2025-12-25 18:02:03 +08:00
Caiyanpeng
790e8b0b98 Merge remote-tracking branch 'origin/main' 2025-12-25 17:05:03 +08:00
Caiyanpeng
41a2deaf04 ios 环境 2025-12-25 17:04:51 +08:00
1fa0b57355 版本号图标 2025-12-25 17:04:32 +08:00
5462cf5abe 按设计稿修改,中英文,ios图标问题,statusbar等 2025-12-25 16:16:01 +08:00
b6e6905d05 增加i18n需要的中英文对照表,但还没做功能 2025-12-19 11:58:52 +08:00
539c425a89 说明文字 2025-12-19 00:05:42 +08:00
d72b18f713 Initial commit of React Native app 2025-12-18 13:27:24 +08:00
44 changed files with 1786 additions and 333 deletions

32
App.tsx
View File

@ -8,6 +8,9 @@ import InfoScreen from "./src/InfoScreen";
import DfuScreen from "./src/DfuScreen";
import PrivacyScreen from "./src/PrivacyScreen";
import SplashScreen from "./src/SplashScreen"; // ✅ 新增启动页
import pxToDp from "./src/helper/pxToDp";
import SettingScreen from "./src/SettingScreen";
import './src/i18n'
export type RootStackParamList = {
Splash: undefined;
@ -16,6 +19,7 @@ export type RootStackParamList = {
Info: { peripheral: any };
Dfu: { deviceId: string; name: string; firmware: string };
Privacy: undefined;
Setting: undefined;
};
const Stack = createNativeStackNavigator<RootStackParamList>();
@ -25,13 +29,9 @@ export default function App() {
<NavigationContainer>
<Stack.Navigator
initialRouteName="Splash"
// ✅ 统一所有导航栏样式
screenOptions={{
headerStyle: { backgroundColor: "#E7141E" }, // 顶部背景红色
headerTintColor: "#fff", // 返回箭头和文字为白色
headerTitleStyle: { fontWeight: "bold", color: "#fff" }, // 标题白色+加粗
}}
>
animation : 'slide_from_right'
}}>
{/* 启动页(无标题) */}
<Stack.Screen
name="Splash"
@ -43,29 +43,39 @@ export default function App() {
<Stack.Screen
name="Home"
component={HomeScreen}
options={{ title: "" }}
options={{ headerShown: false }}
/>
{/* 其他页面默认显示标题栏 */}
<Stack.Screen
name="Scan"
component={ScanScreen}
options={{ title: "搜索设备" }}
// options={{ title: "搜索设备" }}
options={{ headerShown: false }}
/>
<Stack.Screen
name="Info"
component={InfoScreen}
options={{ title: "设备信息" }}
// options={{ title: "设备详情" }}
options={{ headerShown: false }}
/>
<Stack.Screen
name="Dfu"
component={DfuScreen}
options={{ title: "固件升级" }}
// options={{ title: "固件升级" }}
options={{ headerShown: false }}
/>
<Stack.Screen
name="Privacy"
component={PrivacyScreen}
options={{ title: "隐私协议" }}
// options={{ title: "隐私协议" }}
options={{ headerShown: false }}
/>
<Stack.Screen
name="Setting"
component={SettingScreen}
// options={{ title: "隐私协议" }}
options={{ headerShown: false }}
/>
</Stack.Navigator>
</NavigationContainer>

View File

@ -82,8 +82,8 @@ android {
applicationId "com.zhixingpai.powerfundfuapp"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0.0"
versionCode 2
versionName "1.0.1"
}
signingConfigs {
debug {

View File

@ -17,7 +17,8 @@
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize"
android:exported="true">
android:exported="true"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />

View File

@ -0,0 +1,3 @@
<resources>
<string name="app_name">POWERFUN设置</string>
</resources>

View File

@ -0,0 +1,9 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
</style>
</resources>

View File

@ -1,3 +1,3 @@
<resources>
<string name="app_name">POWERFUN设置</string>
<string name="app_name">POWERFUN Settings</string>
</resources>

View File

@ -42,3 +42,7 @@ hermesEnabled=true
# This allows your app to draw behind system bars for an immersive UI.
# Note: Only works with ReactActivity and should not be used with custom Activity.
edgeToEdgeEnabled=false

0
android/gradlew vendored Normal file → Executable file
View File

Binary file not shown.

View File

@ -1,3 +1,4 @@
source 'https://cdn.cocoapods.org/'
# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
'require.resolve(

View File

@ -2314,6 +2314,10 @@ PODS:
- React-perflogger (= 0.81.4)
- React-utils (= 0.81.4)
- SocketRocket
- RNCAsyncStorage (2.2.0):
- React-Core
- RNDeviceInfo (15.0.1):
- React-Core
- RNFS (2.20.0):
- React-Core
- RNScreens (4.16.0):
@ -2452,6 +2456,8 @@ DEPENDENCIES:
- ReactAppDependencyProvider (from `build/generated/ios`)
- ReactCodegen (from `build/generated/ios`)
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- "RNCAsyncStorage (from `../node_modules/@react-native-async-storage/async-storage`)"
- RNDeviceInfo (from `../node_modules/react-native-device-info`)
- RNFS (from `../node_modules/react-native-fs`)
- RNScreens (from `../node_modules/react-native-screens`)
- RNVectorIcons (from `../node_modules/react-native-vector-icons`)
@ -2612,6 +2618,10 @@ EXTERNAL SOURCES:
:path: build/generated/ios
ReactCommon:
:path: "../node_modules/react-native/ReactCommon"
RNCAsyncStorage:
:path: "../node_modules/@react-native-async-storage/async-storage"
RNDeviceInfo:
:path: "../node_modules/react-native-device-info"
RNFS:
:path: "../node_modules/react-native-fs"
RNScreens:
@ -2696,6 +2706,8 @@ SPEC CHECKSUMS:
ReactAppDependencyProvider: 433ddfb4536948630aadd5bd925aff8a632d2fe3
ReactCodegen: 1d05923ad119796be9db37830d5e5dc76586aa00
ReactCommon: 394c6b92765cf6d211c2c3f7f6bc601dffb316a6
RNCAsyncStorage: b44e8a4e798c3e1f56bffccd0f591f674fb9198f
RNDeviceInfo: 36d7f232bfe7c9b5c494cb7793230424ed32c388
RNFS: 89de7d7f4c0f6bafa05343c578f61118c8282ed8
RNScreens: 35525ebfe219c8709da0d26aebbc9a5e02e1077b
RNVectorIcons: 9084b0cf37b3c5690b730c5627a21d750c9f517e
@ -2703,6 +2715,6 @@ SPEC CHECKSUMS:
Yoga: a3ed390a19db0459bd6839823a6ac6d9c6db198d
ZIPFoundation: b8c29ea7ae353b309bc810586181fd073cb3312c
PODFILE CHECKSUM: acd3fbdda50772beaab05ce909d5ed701116dee5
PODFILE CHECKSUM: a23d7c8b0484328e91cacd79617607a52e3cf7fb
COCOAPODS: 1.16.2

View File

@ -11,6 +11,7 @@
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
761780ED2CA45674006654EE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 761780EC2CA45674006654EE /* AppDelegate.swift */; };
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
82A7EFF22EFD325200209B1F /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 82A7EFF02EFD325200209B1F /* InfoPlist.strings */; };
ADAFE5564C0102A1789FE063 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */; };
/* End PBXBuildFile section */
@ -24,6 +25,9 @@
5DCACB8F33CDC322A6C60F78 /* libPods-dfuapp.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-dfuapp.a"; sourceTree = BUILT_PRODUCTS_DIR; };
761780EC2CA45674006654EE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = dfuapp/AppDelegate.swift; sourceTree = "<group>"; };
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = dfuapp/LaunchScreen.storyboard; sourceTree = "<group>"; };
82A7EFF12EFD325200209B1F /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
82A7EFF32EFD325E00209B1F /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/InfoPlist.strings"; sourceTree = "<group>"; };
82A7EFF72EFD3C7000209B1F /* MaterialCommunityIcons.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = MaterialCommunityIcons.ttf; sourceTree = "<group>"; };
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */
@ -42,6 +46,8 @@
13B07FAE1A68108700A75B9A /* dfuapp */ = {
isa = PBXGroup;
children = (
82A7EFF82EFD3C7000209B1F /* Fonts */,
82A7EFF02EFD325200209B1F /* InfoPlist.strings */,
13B07FB51A68108700A75B9A /* Images.xcassets */,
761780EC2CA45674006654EE /* AppDelegate.swift */,
13B07FB61A68108700A75B9A /* Info.plist */,
@ -60,6 +66,14 @@
name = Frameworks;
sourceTree = "<group>";
};
82A7EFF82EFD3C7000209B1F /* Fonts */ = {
isa = PBXGroup;
children = (
82A7EFF72EFD3C7000209B1F /* MaterialCommunityIcons.ttf */,
);
path = Fonts;
sourceTree = "<group>";
};
832341AE1AAA6A7D00B99B32 /* Libraries */ = {
isa = PBXGroup;
children = (
@ -142,6 +156,7 @@
knownRegions = (
en,
Base,
"zh-Hans",
);
mainGroup = 83CBB9F61A601CBA00E9B192;
productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */;
@ -159,6 +174,7 @@
buildActionMask = 2147483647;
files = (
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */,
82A7EFF22EFD325200209B1F /* InfoPlist.strings in Resources */,
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
ADAFE5564C0102A1789FE063 /* PrivacyInfo.xcprivacy in Resources */,
);
@ -252,6 +268,18 @@
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
82A7EFF02EFD325200209B1F /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
82A7EFF12EFD325200209B1F /* en */,
82A7EFF32EFD325E00209B1F /* zh-Hans */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
13B07F941A680F5B00A75B9A /* Debug */ = {
isa = XCBuildConfiguration;
@ -269,7 +297,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.0;
MARKETING_VERSION = 1.0.1;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
@ -298,7 +326,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.0;
MARKETING_VERSION = 1.0.1;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
</Workspace>

View File

@ -22,6 +22,8 @@
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
@ -31,17 +33,12 @@
<key>NSAllowsLocalNetworking</key>
<true/>
</dict>
<!-- iOS 13+ 需要的蓝牙权限 -->
<key>NSBluetoothAlwaysUsageDescription</key>
<string>我们需要使用蓝牙连接您的功率计设备</string>
<!-- iOS 12 及以下版本需要的蓝牙权限(向后兼容) -->
<key>NSBluetoothPeripheralUsageDescription</key>
<string>我们需要使用蓝牙连接您的功率计设备</string>
<!-- 位置权限Android 和某些 iOS 蓝牙扫描需要) -->
<key>NSLocationWhenInUseUsageDescription</key>
<string>我们需要位置权限来扫描附近的蓝牙功率计设备</string>
<key>NSBluetoothAlwaysUsageDescription</key>
<string>我们需要使用蓝牙连接您的功率计设备</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>我们需要使用蓝牙连接您的功率计设备</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>我们需要位置权限来扫描附近的蓝牙功率计设备</string>
<key>RCTNewArchEnabled</key>
<false/>
<key>UILaunchStoryboardName</key>
@ -53,10 +50,12 @@
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>UIAppFonts</key>
<array>
<string>MaterialCommunityIcons.ttf</string>
</array>
</dict>
</plist>

View File

@ -13,6 +13,14 @@
<string>3B52.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategorySystemBootTime</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>35F9.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
@ -23,10 +31,10 @@
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategorySystemBootTime</string>
<string>NSPrivacyAccessedAPICategoryDiskSpace</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>35F9.1</string>
<string>85F4.1</string>
</array>
</dict>
</array>

View File

@ -0,0 +1,2 @@
CFBundleDisplayName = "POWERFUN Settings";
CFBundleName = "POWERFUN Settings";

View File

@ -0,0 +1,2 @@
CFBundleDisplayName = "POWERFUN设置";
CFBundleName = "POWERFUN设置";

1
package-lock.json generated
View File

@ -8,6 +8,7 @@
"name": "dfuapp",
"version": "0.0.1",
"dependencies": {
"@react-native/codegen": "0.81.4",
"@react-native/new-app-screen": "0.81.4",
"@react-navigation/native": "^7.1.17",
"@react-navigation/native-stack": "^7.3.26",

View File

@ -4,6 +4,7 @@
"private": true,
"scripts": {
"android": "react-native run-android",
"clean-a": "cd android && gradlew clean",
"ios": "react-native run-ios",
"lint": "eslint .",
"start": "react-native start",
@ -11,18 +12,25 @@
"build-a": "set NODE_OPTIONS=--openssl-legacy-provider && cd android&&gradlew assembleRelease"
},
"dependencies": {
"@react-native-async-storage/async-storage": "^2.2.0",
"@react-native/codegen": "0.81.4",
"@react-native/new-app-screen": "0.81.4",
"@react-navigation/native": "^7.1.17",
"@react-navigation/native-stack": "^7.3.26",
"@systemic-games/react-native-bluetooth-le": "^1.3.0",
"@systemic-games/react-native-nordic-nrf5-dfu": "^1.3.0",
"@types/lodash": "^4.17.21",
"base-64": "^1.0.0",
"i18next": "^25.7.3",
"react": "19.1.0",
"react-i18next": "^16.5.0",
"react-native": "0.81.4",
"react-native-device-info": "^15.0.1",
"react-native-fs": "^2.20.0",
"react-native-safe-area-context": "^5.6.1",
"react-native-safearea-height": "^1.0.8",
"react-native-screens": "^4.16.0",
"react-native-toast-message": "^2.3.3",
"react-native-vector-icons": "^10.3.0"
},
"devDependencies": {

View File

@ -4,6 +4,9 @@ import { NativeStackScreenProps } from "@react-navigation/native-stack";
import { RootStackParamList } from "../App";
import RNFS from "react-native-fs";
import { startDfu, DfuProgressEvent, DfuStateEvent } from "@systemic-games/react-native-nordic-nrf5-dfu";
import { useTranslation } from 'react-i18next';
import MyStatusbar from "./component/MyStatusbar";
import MyHeader from "./component/MyHeader";
type Props = NativeStackScreenProps<RootStackParamList, "Dfu">;
@ -14,33 +17,34 @@ interface DeviceInfo {
}
export default function DfuScreen({ route, navigation }: Props) {
const { t } = useTranslation();
const { deviceId, name, firmware: deviceFirmware } = route.params;
const [progress, setProgress] = useState(0);
const [state, setState] = useState("准备中...");
const [state, setState] = useState(t('dfu.preparing'));
const [error, setError] = useState<string>();
const [latestVersion, setLatestVersion] = useState<string>("读取中...");
const [latestVersion, setLatestVersion] = useState<string>(t('dfu.reading'));
const [isDfuRunning, setIsDfuRunning] = useState(false);
const mapDfuStateToChinese = (state: string): string => {
switch (state) {
case "connecting": return "连接中…";
case "starting": return "初始化中…";
case "enablingDfuMode": return "启用 DFU 模式…";
case "uploading": return "上传固件中…";
case "validating": return "校验固件…";
case "disconnecting": return "断开连接…";
case "completed": return "升级完成";
case "aborted": return "已取消";
case "connecting": return t('dfu.stateConnecting');
case "starting": return t('dfu.stateStarting');
case "enablingDfuMode": return t('dfu.stateEnablingDfuMode');
case "uploading": return t('dfu.stateUploading');
case "validating": return t('dfu.stateValidating');
case "disconnecting": return t('dfu.stateDisconnecting');
case "completed": return t('dfu.stateCompleted');
case "aborted": return t('dfu.stateAborted');
case "failed":
case "dfu_failed": return "升级失败";
case "initializing": return "启动中…";
case "errored": return "升级出错!";
case "dfu_failed": return t('dfu.stateFailed');
case "initializing": return t('dfu.stateInitializing');
case "errored": return t('dfu.stateErrored');
default: return state;
}
};
// ✅ 拦截所有导航返回iOS + Android
useEffect(() => {
const unsubscribe = navigation.addListener("beforeRemove", (e) => {
@ -48,13 +52,13 @@ export default function DfuScreen({ route, navigation }: Props) {
// 阻止返回
e.preventDefault();
Alert.alert("请稍候", "正在升级,请勿返回或关闭应用!");
Alert.alert(t('dfu.pleaseWait'), t('dfu.doNotReturn'));
});
return unsubscribe;
}, [navigation, isDfuRunning]);
useEffect(() => {
@ -76,8 +80,8 @@ export default function DfuScreen({ route, navigation }: Props) {
const deviceInfo = manifest.devices.find(d => d.hardware === deviceHW);
if (!deviceInfo) {
setIsDfuRunning(false);
Alert.alert("无法升级", `未找到硬件版本 ${deviceHW} 的固件`, [
{ text: "确认", onPress: () => navigation.goBack() },
Alert.alert(t('dfu.cannotUpgrade'), t('dfu.hardwareNotFound', { hardware: deviceHW }), [
{ text: t('dfu.confirm'), onPress: () => navigation.goBack() },
]);
return;
}
@ -89,8 +93,8 @@ export default function DfuScreen({ route, navigation }: Props) {
if (latestFW <= deviceFW) {
setIsDfuRunning(false);
Alert.alert("无需升级", "已是最新固件,无需升级", [
{ text: "确认", onPress: () => navigation.goBack() },
Alert.alert(t('dfu.noNeedUpgrade'), t('dfu.alreadyLatest'), [
{ text: t('dfu.confirm'), onPress: () => navigation.goBack() },
]);
return;
}
@ -104,14 +108,14 @@ export default function DfuScreen({ route, navigation }: Props) {
});
setIsDfuRunning(false);
Alert.alert("升级成功", "升级成功,请重连设备", [
{ text: "确认", onPress: () => navigation.navigate("Home") },
Alert.alert(t('dfu.upgradeSuccess'), t('dfu.upgradeSuccessMessage'), [
{ text: t('dfu.confirm'), onPress: () => navigation.navigate("Home") },
]);
} catch (err: any) {
setIsDfuRunning(false);
setError(err.message || "DFU失败");
Alert.alert("升级失败", err.message || "DFU失败", [
{ text: "确认", onPress: () => navigation.goBack() },
setError(err.message || t('dfu.dfuFailed'));
Alert.alert(t('dfu.upgradeFailed'), err.message || t('dfu.dfuFailed'), [
{ text: t('dfu.confirm'), onPress: () => navigation.goBack() },
]);
}
};
@ -120,27 +124,40 @@ export default function DfuScreen({ route, navigation }: Props) {
}, [deviceId, deviceFirmware, navigation]);
return (
<View style={{ flex: 1, padding: 20 }}>
<View style={styles.row}>
<Text style={{ fontSize: 18 }}>: {name}</Text>
</View>
<View style={styles.row}>
<Text style={{ fontSize: 16 }}>: {latestVersion}</Text>
</View>
<View style={styles.row}>
<Text style={{ fontSize: 16 }}>: {deviceFirmware}</Text>
</View>
<View style={styles.row}>
<Text style={{ fontSize: 16 }}>: {mapDfuStateToChinese(state)}</Text>
</View>
<View style={{flex:1,backgroundColor:'#f2f3f7'}}>
<MyStatusbar backgroundColor="#f2f3f7" dark></MyStatusbar>
<MyHeader title={t("dfu.title")} textColor="#333" backgroundColor="#f2f3f7" navigation={navigation}></MyHeader>
<View style={{ flex: 1, padding: 20 }}>
{/* 横向进度条 */}
<View style={styles.progressContainer}>
<View style={[styles.progressBar, { width: `${progress}%` }]} />
<Text style={styles.progressText}>{progress}%</Text>
</View>
<View style={styles.row}>
<Text style={{ fontSize: 16, color: "#333" }}>
{t('dfu.bluetoothName')}: {name}
</Text>
</View>
<View style={styles.row}>
<Text style={{ fontSize: 16, color: "#333" }}>
{t('dfu.latestVersion')}: {latestVersion}
</Text>
</View>
<View style={styles.row}>
<Text style={{ fontSize: 16, color: "#333" }}>
{t('dfu.currentVersion')}: {deviceFirmware}
</Text>
</View>
<View style={styles.row}>
<Text style={{ fontSize: 16, color: "#333" }}>
{t('dfu.upgradeStatus')}: {mapDfuStateToChinese(state)}
</Text>
</View>
{error && <Text style={{ color: "red", marginTop: 20 }}>{error}</Text>}
{/* 横向进度条 */}
<View style={styles.progressContainer}>
<View style={[styles.progressBar, { width: `${progress}%` }]} />
<Text style={styles.progressText}>{progress}%</Text>
</View>
{error && <Text style={{ color: "red", marginTop: 20 }}>{error}</Text>}
</View>
</View>
);
}

View File

@ -1,33 +1,36 @@
import React from "react";
import { View, Text, TouchableOpacity, StyleSheet, StatusBar } from "react-native";
import { NativeStackScreenProps } from "@react-navigation/native-stack";
import { View, Text, TouchableOpacity, StyleSheet, StatusBar, Image } from "react-native";
import { NativeStackScreenProps,NativeStackNavigationProp } from "@react-navigation/native-stack";
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';
type Props = NativeStackScreenProps<RootStackParamList, "Home">;
type Props = NativeStackScreenProps<RootStackParamList>;
export default function HomeScreen({ navigation }: Props) {
const { t } = useTranslation();
return (
<View style={styles.container}>
{/* 设置状态栏颜色 */}
<StatusBar backgroundColor="#E7141E" barStyle="light-content" />
<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>
{/* 中间按钮 */}
<View style={styles.centerBox}>
<Image source={require("./img/Search.png")} style={{width:pxToDp(568),height:pxToDp(344),marginBottom:pxToDp(100)}}></Image>
<TouchableOpacity
style={styles.button}
onPress={() => navigation.navigate("Scan")}
>
<Text style={styles.buttonText}></Text>
<Text style={styles.buttonText}>{t('home.scan')}</Text>
</TouchableOpacity>
</View>
{/* 底部区域 */}
<View style={styles.bottomBox}>
<TouchableOpacity onPress={() => navigation.navigate("Privacy")}>
<Text style={styles.privacyText}></Text>
</TouchableOpacity>
<Text style={styles.version}> v0.0.1</Text>
</View>
</View>
);
}
@ -39,18 +42,22 @@ const styles = StyleSheet.create({
},
centerBox: {
flex: 1,
justifyContent: "center",
// justifyContent: "center",
alignItems: "center",
backgroundColor:'#fff',
paddingTop:pxToDp(250)
},
button: {
backgroundColor: "#E7141E", // 红色按钮
paddingVertical: 15,
paddingHorizontal: 40,
borderRadius: 10,
backgroundColor: "#E7141E",
borderRadius: pxToDp(24),
width:pxToDp(300),
height:pxToDp(96),
alignItems:'center',
justifyContent:'center'
},
buttonText: {
color: "#fff",
fontSize: 18,
fontSize: pxToDp(32),
fontWeight: "bold",
},
bottomBox: {

View File

@ -19,7 +19,9 @@ import {
ConnectionStatus,
} from "@systemic-games/react-native-bluetooth-le";
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import { useTranslation } from 'react-i18next';
import MyStatusbar from "./component/MyStatusbar";
import MyHeader from "./component/MyHeader";
type Props = NativeStackScreenProps<RootStackParamList, "Info">;
@ -34,10 +36,9 @@ const fullUUID = (uuid: string) =>
: uuid;
const Text = ({ children, style, ...props }: any) => {
const isDark = useColorScheme() === "dark";
return (
<RNText
style={[{ color: isDark ? "white" : "black", fontSize: 16 }, style]}
style={[{ color: "black", fontSize: 16 }, style]}
{...props}
>
{children}
@ -46,17 +47,23 @@ const Text = ({ children, style, ...props }: any) => {
};
export default function InfoScreen({ route, navigation }: Props) {
const { t } = useTranslation();
const { peripheral } = route.params;
const deviceKey = peripheral.address || peripheral.systemId;
const [power, setPower] = useState<number>(0);
const [cadence, setCadence] = useState<number>(0);
const [leftbalance, setLeftBalance] = useState<number>(0);
const [rightbalance, setRightBalance] = useState<number>(0);
const [isConnected, setIsConnected] = useState(false);
const [isLoading, setIsLoading] = useState(true);
const [serial, setSerial] = useState("读取中...");
const [firmware, setFirmware] = useState("读取中...");
const [hardware, setHardware] = useState("读取中...");
const [battery, setBattery] = useState("读取中...");
const [powerTrim, setPowerTrim] = useState("读取中");
const [inputTrim, setInputTrim] = useState("100");
const [serial, setSerial] = useState(t('info.reading'));
const [firmware, setFirmware] = useState(t('info.reading'));
const [hardware, setHardware] = useState(t('info.reading'));
const [battery, setBattery] = useState(t('info.reading'));
const [powerTrim, setPowerTrim] = useState(t('info.reading'));
const [inputTrim, setInputTrim] = useState("");
const [readSuccessToast, setReadSuccessToast] = useState(false); // ✅ 读取成功提示
const [powerTrimLoading, setPowerTrimLoading] = useState(false); // 正在写入功率微调
@ -69,59 +76,66 @@ export default function InfoScreen({ route, navigation }: Props) {
const prevConnectedRef = useRef(isConnected);
const isActiveRef = useRef(true);
//增加校准按钮相关状态
const [calibrating, setCalibrating] = useState<boolean>(false);
const [calibrationSuccess, setCalibrationSuccess] = useState<boolean>(false);
const [calibrationValue, setCalibrationValue] = useState<string>("");
const calibrationTimeoutRef = useRef<number | null>(null);
const isCalibratingRef = useRef<boolean>(false);
useFocusEffect(
React.useCallback(() => {
// 页面获得焦点
isActiveRef.current = true;
return () => {
// 页面失去焦点
isActiveRef.current = false;
};
}, [])
);
React.useCallback(() => {
// 页面获得焦点
isActiveRef.current = true;
return () => {
// 页面失去焦点
isActiveRef.current = false;
};
}, [])
);
// ========== 监听连接状态变化,断开时提示重新连接 ==========
useEffect(() => {
if (prevConnectedRef.current && !isConnected && isActiveRef.current) {
Alert.alert("提示", "请重新连接设备", [
{ text: "确定", onPress: () => navigation.goBack() },
]);
}
prevConnectedRef.current = isConnected;
}, [isConnected]);
if (prevConnectedRef.current && !isConnected && isActiveRef.current) {
Alert.alert(t('info.disconnectTitle'), t('info.disconnectMessage'), [
{ text: t('info.confirm'), onPress: () => navigation.goBack() },
]);
}
prevConnectedRef.current = isConnected;
}, [isConnected]);
// ========== 页面即将返回时,强制断开蓝牙 ==========
useEffect(() => {
const unsubscribe = navigation.addListener("beforeRemove", async (e) => {
if (disconnectingRef.current) return;
disconnectingRef.current = true;
const unsubscribe = navigation.addListener("beforeRemove", async (e) => {
if (disconnectingRef.current) return;
disconnectingRef.current = true;
const next = e.data.action?.type;
const action = e.data.action as any;
const next = e.data.action?.type;
const action = e.data.action as any;
// ✅ 判断是否跳转到 Dfu 页面
if (next === "NAVIGATE" && action?.payload?.name === "Dfu") {
console.log("➡️ 跳转到 DFU不断开蓝牙");
disconnectingRef.current = false;
return;
}
// ✅ 判断是否跳转到 Dfu 页面
if (next === "NAVIGATE" && action?.payload?.name === "Dfu") {
console.log("➡️ 跳转到 DFU不断开蓝牙");
disconnectingRef.current = false;
return;
}
// 🔌 其他页面离开则断开蓝牙
console.log("📴 页面关闭,断开蓝牙...");
try {
await Central.disconnectPeripheral(peripheral);
console.log("✅ 已断开蓝牙");
} catch (err) {
console.warn("❌ 断开失败:", err);
} finally {
disconnectingRef.current = false;
}
});
return unsubscribe;
}, [navigation, peripheral]);
// 🔌 其他页面离开则断开蓝牙
console.log("📴 页面关闭,断开蓝牙...");
try {
await Central.disconnectPeripheral(peripheral);
console.log("✅ 已断开蓝牙");
} catch (err) {
console.warn("❌ 断开失败:", err);
} finally {
disconnectingRef.current = false;
}
});
return unsubscribe;
}, [navigation, peripheral]);
// ========== BLE notify 订阅 ==========
// ========== BLE notify 订阅FFF3 ==========
useEffect(() => {
const connectionHandler = async (ev: {
peripheral: ScannedPeripheral;
@ -142,7 +156,7 @@ export default function InfoScreen({ route, navigation }: Props) {
peripheral,
fullUUID(powerServiceUuid),
fullUUID(powerNotifyUuid)
).catch(() => {});
).catch(() => { });
await Central.subscribeCharacteristic(
peripheral,
fullUUID(powerServiceUuid),
@ -151,13 +165,17 @@ export default function InfoScreen({ route, navigation }: Props) {
try {
const raw = (notifyEv as any).value;
if (!raw) return;
const arr =
raw instanceof Uint8Array
? Array.from(raw)
: Array.from(new Uint8Array(raw));
if (arr[0] === 0x02 && arr.length >= 2) {
setPowerTrim(arr[1].toString());
setInputTrim(arr[1].toString());
const byteArray = raw instanceof Uint8Array
? raw
: new Uint8Array(raw);
if (byteArray[0] === 0x02 && byteArray.length >= 2) {
// 功率微调数据
setPowerTrim(byteArray[1].toString());
//setInputTrim(byteArray[1].toString());
}
else if (byteArray[0] === 0x05 && byteArray.length >= 3) {
// 校准响应数据 (05XXXX格式)
handleFFF3Response(byteArray);
}
} catch (err) {
console.warn("notify parse error", err);
@ -172,6 +190,8 @@ export default function InfoScreen({ route, navigation }: Props) {
}
};
Central.addListener("peripheralConnectionStatus", connectionHandler);
return () => {
Central.removeListener("peripheralConnectionStatus", connectionHandler);
@ -217,24 +237,24 @@ export default function InfoScreen({ route, navigation }: Props) {
console.log("✅ info 读取完成");
try {
await Central.writeCharacteristic(
peripheral,
fullUUID(powerServiceUuid),
fullUUID(powerWriteUuid),
new Uint8Array([0x04]).buffer,
{ withoutResponse: false }
);
console.log("✅ 已发送 0x04等待 notify 更新功率微调");
await Central.writeCharacteristic(
peripheral,
fullUUID(powerServiceUuid),
fullUUID(powerWriteUuid),
new Uint8Array([0x04]).buffer,
{ withoutResponse: false }
);
console.log("✅ 已发送 0x04等待 notify 更新功率微调");
// notify 回调里已经订阅了,所以这里不用再重复订阅
// 可以稍等 300ms确保 notify 回来后 UI 会更新
await new Promise<void>(resolve => setTimeout(() => resolve(), 300));
} catch (err) {
console.warn("❌ 首次读取功率微调失败", err);
}
// notify 回调里已经订阅了,所以这里不用再重复订阅
// 可以稍等 300ms确保 notify 回来后 UI 会更新
await new Promise<void>(resolve => setTimeout(() => resolve(), 300));
} catch (err) {
console.warn("❌ 首次读取功率微调失败", err);
}
} catch (e) {
console.warn("❌ 读取失败", e);
@ -249,11 +269,182 @@ export default function InfoScreen({ route, navigation }: Props) {
})();
}, [peripheral]);
// ========== 订阅 1818 服务的 2A63 特性 (通知) ==========
useEffect(() => {
const subscribeToPowerData = async () => {
try {
// 确保设备已经连接
if (!isConnected) return;
console.log("✅ 订阅 2A63 特性通知...");
// 先取消之前的订阅(防止重复订阅)
await Central.unsubscribeCharacteristic(
peripheral,
fullUUID("1818"),
fullUUID("2a63")
).catch(() => { });
// 订阅 2A63 特性通知
await Central.subscribeCharacteristic(
peripheral,
fullUUID("1818"),
fullUUID("2a63"),
(notifyEv) => {
try {
const raw = notifyEv.value;
if (raw) {
// 将 ArrayBuffer 转换为字节数组
const byteArray = new Uint8Array(raw);
// 解析数据
parseData(byteArray);
}
} catch (err) {
console.warn("❌ 处理通知数据失败", err);
}
}
);
console.log("✅ 已订阅 2A63 特性通知");
} catch (err) {
console.warn("❌ 订阅 2A63 特性失败", err);
}
};
// 只在设备已连接时进行订阅
if (peripheral && isConnected) {
subscribeToPowerData();
}
// 清理订阅(当组件卸载或者连接状态变化时)
return () => {
if (peripheral && isConnected) {
Central.unsubscribeCharacteristic(peripheral, fullUUID("1818"), fullUUID("2a63")).catch(() => { });
}
};
}, [peripheral, isConnected]);
const cadenceStateRef = useRef({
lastCadenceCount: 0, // 上一次的踏频翻转次数,用于计算差值
lastCadenceTimestamp: 0, // 上一次的踏频时间戳(设备时间),用于计算差值
lastCadenceChangedTime: 0, // 最后一次踏频变化的时间(本地时间),用于检测超时
});
const parseData = (byteArray: Uint8Array) => {
// 当前时间(用于超时检测)
const currentTime = Date.now();
// ========== 1. 解析功率 ==========
// 字节2-3功率值小端序
const powerValue = (byteArray[3] << 8) | byteArray[2];
setPower(powerValue);
// ========== 3. 解析踏频 ==========
// 字节5-6踏频翻转次数小端序
const cadenceCount = (byteArray[6] << 8) | byteArray[5];
// 字节7-8踏频时间戳小端序
const timestamp = (byteArray[8] << 8) | byteArray[7];
// 获取上一次的状态
const lastState = cadenceStateRef.current;
// 检测踏频翻转次数是否有变化
const hasCadenceChanged = cadenceCount !== lastState.lastCadenceCount;
if (hasCadenceChanged) {
// 踏频有变化,更新变化时间戳
cadenceStateRef.current.lastCadenceChangedTime = currentTime;
}
// 检查是否超时3秒无变化
if (lastState.lastCadenceChangedTime > 0 &&
currentTime - lastState.lastCadenceChangedTime > 3000) {
//setPower("0 W");
setCadence(0);
setLeftBalance(0);
setRightBalance(0);
cadenceStateRef.current = {
lastCadenceCount: 0,
lastCadenceTimestamp: 0,
lastCadenceChangedTime: 0,
};
return; // 超时后直接返回,不再计算踏频
}
// 如果是第一次收到踏频数据,只记录不计算
if (lastState.lastCadenceTimestamp === 0) {
cadenceStateRef.current = {
lastCadenceCount: cadenceCount,
lastCadenceTimestamp: timestamp,
lastCadenceChangedTime: hasCadenceChanged ? currentTime : 0,
};
setCadence(0);
return;
}
// 计算踏频RPM只在踏频有变化时计算
if (hasCadenceChanged) {
// 计算翻转次数差处理16位计数器翻转
let revDiff = cadenceCount - lastState.lastCadenceCount;
if (revDiff < 0) {
revDiff += 65536; // 16位计数器最大值65535
}
// 计算时间差处理16位计数器翻转
let timeDiff = timestamp - lastState.lastCadenceTimestamp;
if (timeDiff < 0) {
timeDiff += 65536; // 16位计数器最大值65535
}
// 计算踏频
if (timeDiff > 0 && revDiff > 0) {
// 假设时间单位是1/1024秒蓝牙设备常用
const timeInSeconds = timeDiff / 1024.0;
// RPM = (圈数 / 时间(秒)) * 60
const cadenceRPM = (revDiff / timeInSeconds) * 60;
// 限制合理范围
if (cadenceRPM > 10 && cadenceRPM < 250) {
setCadence(Math.round(cadenceRPM));
} else {
setCadence(0);
}
} else {
// 如果没有翻转踏频为0
setCadence(0);
}
// ========== 解析左平衡 ==========
// 字节4左平衡值单位0.5%
const leftBalanceValue = byteArray[4];
const leftBalancePercent = Math.round(leftBalanceValue * 0.5 * 10) / 10;
setLeftBalance(leftBalancePercent);
// 计算右平衡100% - 左平衡百分比
const rightBalancePercent = Math.round((100 - leftBalancePercent) * 10) / 10;
setRightBalance(rightBalancePercent);
// 更新踏频计算状态
cadenceStateRef.current = {
...cadenceStateRef.current,
lastCadenceCount: cadenceCount,
lastCadenceTimestamp: timestamp,
};
}
};
// ========== 写入功率微调 ==========
const updatePowerTrim = async () => {
const val = parseInt(inputTrim);
if (isNaN(val) || val < 50 || val > 200) {
Alert.alert("提示", "请输入有效数字50~200");
Alert.alert(t('info.disconnectTitle'), t('info.trimRangeAlert'));
return;
}
if (val === Number(powerTrim)) {
@ -261,7 +452,7 @@ export default function InfoScreen({ route, navigation }: Props) {
return;
}
if (!isConnected) {
Alert.alert("提示", "设备未连接");
Alert.alert(t('info.disconnectTitle'), t('info.deviceNotConnected'));
return;
}
@ -291,105 +482,285 @@ export default function InfoScreen({ route, navigation }: Props) {
} catch (err) {
console.warn("❌ 写入失败", err);
Alert.alert("写入失败");
Alert.alert(t('info.writeFailed'));
}
};
// ========== UI ==========
return (
<ScrollView contentContainerStyle={{ padding: 20, gap: 8 }}>
<View style={styles.row}>
<Text>: {peripheral.name}</Text>
</View>
<View style={styles.row}>
<Text>ID号: {serial}</Text>
</View>
<View style={styles.row}>
<Text>: {firmware}</Text>
</View>
<View style={styles.row}>
<Text>: {battery}</Text>
</View>
<View style={styles.row}>
<Text>: {isConnected ? "已连接" : "未连接"}</Text>
</View>
<View style={{ marginTop: 20 }}>
<Text>: {powerTrim}%</Text>
<TextInput
style={styles.input}
value={inputTrim}
onChangeText={setInputTrim}
keyboardType="numeric"
onEndEditing={updatePowerTrim}
/>
<Pressable onPress={updatePowerTrim} style={styles.pressable} disabled={isLoading || powerTrimLoading}>
<Text style={{ color: "white" }}></Text>
</Pressable>
</View>
<View style={{ marginTop: 30 }}>
<Pressable
onPress={() => {
// ========== 校准按钮逻辑 ==========
const handleCalibration = async () => {
if (!isConnected) {
Alert.alert("提示", "请重新连接设备", [
{
text: "确定",
onPress: () => {
// 返回 ScanScreen
navigation.goBack();
},
},
]);
Alert.alert(t('info.disconnectTitle'), t('info.deviceNotConnected'));
return;
}
// 蓝牙已连接,正常跳转 DFU
navigation.navigate("Dfu", {
deviceId: deviceKey,
name: peripheral.name,
firmware,
});
}}
style={styles.pressable}
disabled={isLoading || powerTrimLoading} // ❌ 禁用点击
>
<Text style={{ color: "white" }}></Text>
</Pressable>
</View>
if (calibrating) {
return; // 正在校准中,不重复点击
}
{isLoading && (
<View style={{ marginVertical: 60, alignItems: "center" }}>
<ActivityIndicator size={80} color="#E7141E" />
<Text style={{ marginTop: 10, fontSize: 16 }}>...</Text>
try {
setCalibrating(true);
isCalibratingRef.current = true;
setCalibrationSuccess(false);
setCalibrationValue("");
console.log("🔧 开始校准向FFF2写入05");
// 向FFF2写入05
await Central.writeCharacteristic(
peripheral,
fullUUID("FFF1"), // 服务UUID
fullUUID("FFF2"), // 写入特征UUID
new Uint8Array([0x05]).buffer,
{ withoutResponse: false }
);
console.log("✅ 已发送校准命令,等待响应...");
// 设置5秒超时
calibrationTimeoutRef.current = setTimeout(() => {
if (isCalibratingRef.current) {
console.log("❌ 校准超时,未收到响应");
Alert.alert(t('info.calibrationError'), t('info.calibrationTimeout'));
setCalibrating(false);
isCalibratingRef.current = false;
}
}, 5000);
} catch (err) {
console.warn("❌ 发送校准命令失败", err);
Alert.alert(t('info.error'), t('info.calibrationSendError'));
setCalibrating(false);
isCalibratingRef.current = false;
if (calibrationTimeoutRef.current) {
clearTimeout(calibrationTimeoutRef.current);
}
}
};
const handleFFF3Response = (byteArray: Uint8Array) => {
// 如果不是正在校准中,不处理
if (!isCalibratingRef.current) return;
// 清除超时定时器
if (calibrationTimeoutRef.current) {
clearTimeout(calibrationTimeoutRef.current);
calibrationTimeoutRef.current = null;
}
// 检查响应数据格式05XXXX (05开头后面至少2个字节)
// 假设响应是05 + 2字节的小端序数值
if (byteArray[0] === 0x05 && byteArray.length >= 3) {
// 解析XXXX小端序低位在前高位在后
// byteArray[1] 是低位字节byteArray[2] 是高位字节
const value = Math.round(((byteArray[2] << 8) | byteArray[1]) / 10); //除以10发送出来 不然数据容易乱跳 和码表端处理保持一致
console.log(`✅ 收到校准响应,值: ${value}`);
// 更新状态
setCalibrationValue(value.toString());
setCalibrationSuccess(true);
// 显示成功弹框
Alert.alert(
t('info.calibrationSuccess'),
`${t('info.calibrationValue') + ": "} ${value}`,
[
{
text: t('info.confirm'),
onPress: () => {
setCalibrating(false);
isCalibratingRef.current = false;
setCalibrationSuccess(false);
}
}
]
);
} else {
console.warn("❌ 校准响应格式错误", byteArray);
Alert.alert(t('info.calibrationError'), t('info.calibrationFormatError'));
setCalibrating(false);
isCalibratingRef.current = false;
}
};
useEffect(() => {
return () => {
// 清理校准超时定时器
if (calibrationTimeoutRef.current) {
clearTimeout(calibrationTimeoutRef.current);
calibrationTimeoutRef.current = null;
}
};
}, []);
// ========== UI ==========
return (
<View style={{flex:1, backgroundColor: "#f2f3f7"}}>
<MyStatusbar backgroundColor="#f2f3f7" dark></MyStatusbar>
<MyHeader title={t("info.title")} textColor="#333" backgroundColor="#f2f3f7" navigation={navigation}></MyHeader>
<ScrollView contentContainerStyle={{ padding: 20, gap: 8 }}>
<View style={styles.row}>
<Text>{t('info.bluetoothName') + ": "} {peripheral.name}</Text>
</View>
)}
{/* ✅ 读取成功提示,固定在页面底部 */}
{readSuccessToast && (
<View style={{ marginVertical: 60, alignItems: "center" }}>
<Icon name="check-circle" size={60} color="#E7141E" />
<Text style={{ marginTop: 10, fontSize: 16 }}></Text>
<View style={styles.row}>
<Text>{t('info.idNumber') + ": "} {serial}</Text>
</View>
)}
{/* 正在写入功率微调 */}
{powerTrimLoading && (
<View style={{ marginVertical: 60, alignItems: "center" }}>
<ActivityIndicator size={60} color="#E7141E" />
<Text style={{ marginTop: 10, fontSize: 16 }}>...</Text>
<View style={styles.row}>
<Text>{t('info.firmwareVersion') + ": "} {firmware}</Text>
</View>
)}
{/* 功率微调写入成功 */}
{powerTrimSuccessToast && (
<View style={{ marginVertical: 60, alignItems: "center" }}>
<Icon name="check-circle" size={60} color="#E7141E" />
<Text style={{ marginTop: 10, fontSize: 16 }}></Text>
</View>
)}
<View style={styles.row}>
<Text>{t('info.battery') + ": "} {battery}</Text>
</View>
</ScrollView>
<View style={styles.row}>
<Text>{t('info.connectionStatus') + ": "} {isConnected ? t('info.connected') : t('info.disconnected')}</Text>
</View>
{/* ====== 实时数据三卡片 ====== */}
<View style={styles.realtimeContainer}>
{/* 功率 */}
<View style={styles.realtimeCard}>
<Icon name="flash" size={22} color="#E7141E" />
<Text style={styles.realtimeLabel}>{t('info.power')}</Text>
<Text style={styles.realtimeValue}>{power}</Text>
</View>
{/* 踏频 */}
<View style={styles.realtimeCard}>
<Icon name="sync" size={22} color="#E7141E" />
<Text style={styles.realtimeLabel}>{t('info.cadence')}</Text>
<Text style={styles.realtimeValue}>{cadence}</Text>
</View>
{/* 左右平衡 */}
<View style={styles.realtimeCard}>
<Text style={styles.balanceHeader}>L / R</Text>
<Text style={styles.realtimeLabel}>{t('info.balance')}</Text>
<Text style={styles.realtimeValue}>
{leftbalance}/{rightbalance}
</Text>
</View>
</View>
{/* ========== 功率微调卡片部分 ========== */}
<View style={styles.cardContainer}>
<View style={styles.cardTitle}>
<Text style={[styles.cardTitleText, { textAlign: 'center' }]}>{t('info.powerTrimTitle')}</Text>
</View>
<View style={{
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between',
marginBottom: 0,
paddingHorizontal: 10
}}>
<Text style={{ marginTop: 10, flex: 1, marginRight: 10 }}>{t('info.currentTrim') + ": "} {powerTrim}%</Text>
<TextInput
style={[styles.input, { flex: 1, marginTop: 10 }]}
value={inputTrim}
onChangeText={setInputTrim}
keyboardType="numeric"
onEndEditing={updatePowerTrim}
placeholder={t('info.trimPlaceholder')}
/>
</View>
<Pressable
onPress={updatePowerTrim}
style={styles.pressable}
disabled={isLoading || powerTrimLoading}
>
<Text style={{ color: "white" }}>{t('info.updateValue')}</Text>
</Pressable>
</View>
{/* ========== 新增校准按钮 ========== */}
<View style={{ marginTop: 0 }}>
<Pressable
onPress={handleCalibration}
style={[styles.pressable, calibrating && styles.disabledButton]}
disabled={calibrating || !isConnected}
>
<Text style={{ color: "white" }}>
{calibrating ? t('info.calibrating') : t('info.calibrateButton')}
</Text>
</Pressable>
</View>
<View style={{ marginTop: 0 }}>
<Pressable
onPress={() => {
if (!isConnected) {
Alert.alert(t('info.disconnectTitle'), t('info.reconnectMessage'), [
{
text: t('info.confirm'),
onPress: () => {
// 返回 ScanScreen
navigation.goBack();
},
},
]);
return;
}
// 蓝牙已连接,正常跳转 DFU
navigation.navigate("Dfu", {
deviceId: deviceKey,
name: peripheral.name,
firmware,
});
}}
style={styles.pressable}
disabled={isLoading || powerTrimLoading} // ❌ 禁用点击
>
<Text style={{ color: "white" }}>{t('info.firmwareUpgrade')}</Text>
</Pressable>
</View>
{isLoading && (
<View style={{ marginVertical: 60, alignItems: "center" }}>
<ActivityIndicator size={30} color="#E7141E" />
<Text style={{ marginTop: 10, fontSize: 16 }}>{t('info.readingInfo')}</Text>
</View>
)}
{/* ✅ 读取成功提示,固定在页面底部 */}
{readSuccessToast && (
<View style={{ marginVertical: 60, alignItems: "center" }}>
<Icon name="check-circle" size={30} color="#E7141E" />
<Text style={{ marginTop: 10, fontSize: 16 }}>{t('info.readSuccess')}</Text>
</View>
)}
{/* 正在写入功率微调 */}
{powerTrimLoading && (
<View style={{ marginVertical: 60, alignItems: "center" }}>
<ActivityIndicator size={30} color="#E7141E" />
<Text style={{ marginTop: 10, fontSize: 16 }}>{t('info.writingTrim')}</Text>
</View>
)}
{/* 功率微调写入成功 */}
{powerTrimSuccessToast && (
<View style={{ marginVertical: 60, alignItems: "center" }}>
<Icon name="check-circle" size={30} color="#E7141E" />
<Text style={{ marginTop: 10, fontSize: 16 }}>{t('info.trimUpdateSuccess')}</Text>
</View>
)}
</ScrollView>
</View>
);
}
@ -397,7 +768,7 @@ const styles = StyleSheet.create({
row: {
borderBottomWidth: 1,
borderBottomColor: "#E7141E",
paddingBottom: 4, // 横线和文字保持一定间距
paddingBottom: 3, // 横线和文字保持一定间距
marginBottom: 8, // 行间距
},
input: {
@ -414,4 +785,79 @@ const styles = StyleSheet.create({
borderRadius: 6,
alignItems: "center",
},
disabledButton: {
backgroundColor: "#999", // 禁用时的颜色
opacity: 0.6,
},
cardContainer: {
borderWidth: 1,
borderColor: "#ddd",
borderRadius: 10,
marginTop: 10,
backgroundColor: "#fff",
overflow: 'hidden', // 确保圆角效果完整
shadowColor: "#000",
shadowOffset: { width: 0, height: 1 },
shadowOpacity: 0.1,
shadowRadius: 2,
elevation: 2, // Android阴影
},
cardTitle: {
backgroundColor: "#f5f5f5",
paddingVertical: 8,
paddingHorizontal: 15,
borderBottomWidth: 1,
borderBottomColor: "#eee",
},
cardTitleText: {
fontWeight: 'bold',
color: "#333",
},
realtimeContainer: {
flexDirection: "row",
justifyContent: "space-between",
marginVertical: 10,
},
realtimeCard: {
flex: 1,
marginHorizontal: 4,
paddingVertical: 12,
borderRadius: 10,
backgroundColor: "#fff",
alignItems: "center",
borderWidth: 1,
borderColor: "#E7141E",
shadowColor: "#000",
shadowOffset: { width: 0, height: 1 },
shadowOpacity: 0.1,
shadowRadius: 2,
elevation: 2,
},
realtimeLabel: {
marginTop: 6,
fontSize: 14,
color: "#666",
},
realtimeValue: {
marginTop: 4,
fontSize: 20,
fontWeight: "bold",
color: "#000",
},
balanceHeader: {
fontSize: 16,
fontWeight: "bold",
color: "#E7141E",
},
});

View File

@ -1,80 +1,32 @@
import React from "react";
import { View, Text, ScrollView, StyleSheet } from "react-native";
import MyStatusbar from "./component/MyStatusbar";
import MyHeader from "./component/MyHeader";
import { NativeStackScreenProps,NativeStackNavigationProp } from "@react-navigation/native-stack";
import { RootStackParamList } from "../App";
import { useTranslation } from 'react-i18next';
export default function PrivacyScreen() {
type Props = NativeStackScreenProps<RootStackParamList>;
export default function PrivacyScreen({navigation}:Props) {
const { t } = useTranslation();
return (
<ScrollView style={styles.container}>
<Text style={styles.title}></Text>
<Text style={styles.text}>
使 POWERFUN APP 使
{"\n\n"}
使
{"\n\n"}
1. POWERFUN APP
{"\n\n"}
2. 使使
{"\n"}
- Android ID
{"\n"}
-
{"\n"}
- APP
{"\n"}
- APP
{"\n\n"}
3. SDK 使
{"\n\n"}
1 SDK Bugly
{"\n"}
{"\n"}
ID WiFi
{"\n"}
使使
{"\n\n"}
2 SDK Aliyun OSS
{"\n"}
{"\n"}
使
{"\n\n"}
{"\n\n"}
{"\n\n"}
{"\n"}
-
{"\n"}
-
{"\n"}
-
{"\n\n"}
{"\n\n"}
{"\n"}
bike99@qq.com
{"\n"}
{"\n\n"}
{"\n"}
2019 7 1
</Text>
</ScrollView>
<View style={styles.container}>
<MyStatusbar backgroundColor="#f2f3f7" dark></MyStatusbar>
<MyHeader title={t("privacy.title")} textColor="#333" backgroundColor="#f2f3f7" navigation={navigation}></MyHeader>
<ScrollView style={{ flex: 1, padding: 20 }}>
<Text style={styles.title}>{t("privacy.title")}</Text>
<Text style={styles.text}>{t("privacy.content")}</Text>
</ScrollView>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
padding: 20,
backgroundColor: "#fff",
// padding: 20,
backgroundColor: "#f2f3f7",
},
title: {
fontSize: 22,
@ -85,5 +37,6 @@ const styles = StyleSheet.create({
fontSize: 16,
lineHeight: 24,
color: "#333",
marginBottom: 50
},
});

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>

143
src/SettingScreen.tsx Normal file
View File

@ -0,0 +1,143 @@
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<RootStackParamList>;
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 (
<View style={styles.container}>
<MyStatusbar backgroundColor="#f2f3f7" dark></MyStatusbar>
<MyHeader
title={t('settings.title')}
textColor="#333"
backgroundColor="#f2f3f7"
navigation={navigation}
></MyHeader>
<View style={{ flex: 1, alignItems: 'center', paddingTop: pxToDp(24) }}>
{/* 软件语言 */}
<TouchableOpacity
style={styles.settingItem}
onPress={() => setLanguageModalVisible(true)}
>
<View style={styles.settingItemLeft}>
<Image
style={styles.icon}
source={require("./img/_SoftwareLanguage.png")}
/>
<Text style={styles.settingLabel}>{t('settings.language')}</Text>
</View>
<View style={styles.settingItemRight}>
<Text style={styles.settingValue}>{getCurrentLanguageLabel()}</Text>
<Image
style={styles.arrow}
source={require("./img/Return2.png")}
/>
</View>
</TouchableOpacity>
{/* 隐私协议 */}
<TouchableOpacity
style={[styles.settingItem, { marginTop: pxToDp(20) }]}
onPress={() => navigation.navigate("Privacy")}
>
<View style={styles.settingItemLeft}>
<Image
style={styles.icon}
source={require("./img/_PrivacyAgreement.png")}
/>
<Text style={styles.settingLabel}>{t('settings.privacy')}</Text>
</View>
<View style={styles.settingItemRight}>
<Image
style={styles.arrow}
source={require("./img/Return2.png")}
/>
</View>
</TouchableOpacity>
{/* 版本号 */}
<View style={[styles.settingItem, { marginTop: pxToDp(20) }]}>
<View style={styles.settingItemLeft}>
<Image
style={styles.icon}
source={require("./img/_Versionnumber.png")}
/>
<Text style={styles.settingLabel}>{t('settings.version')}</Text>
</View>
<View style={styles.settingItemRight}>
<Text style={styles.settingValue}>{DeviceInfo.getVersion()}</Text>
</View>
</View>
</View>
{/* 语言切换弹窗 */}
<LanguageModal
visible={languageModalVisible}
onClose={() => setLanguageModalVisible(false)}
/>
</View>
);
}
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),
},
});

View File

@ -2,8 +2,9 @@ import React, { useEffect } from "react";
import { View, Image, StyleSheet } from "react-native";
import { NativeStackScreenProps } from "@react-navigation/native-stack";
import { RootStackParamList } from "../App";
import MyStatusbar from "./component/MyStatusbar";
type Props = NativeStackScreenProps<RootStackParamList, "Splash">;
type Props = NativeStackScreenProps<RootStackParamList>;
export default function SplashScreen({ navigation }: Props) {
useEffect(() => {
@ -16,6 +17,7 @@ export default function SplashScreen({ navigation }: Props) {
return (
<View style={styles.container}>
<MyStatusbar backgroundColor="#E7141E" dark={false}></MyStatusbar>
<Image
source={require("../assets/logo.png")} // ✅ 替换为你自己的图片
style={styles.logo}

View File

@ -0,0 +1,131 @@
import React from 'react';
import {
Modal,
View,
Text,
TouchableOpacity,
StyleSheet,
Pressable,
Image,
} from 'react-native';
import { useTranslation } from 'react-i18next';
import { LANGUAGES, saveLanguage } from '../i18n';
import pxToDp from '../helper/pxToDp';
interface LanguageModalProps {
visible: boolean;
onClose: () => void;
}
const LanguageModal: React.FC<LanguageModalProps> = ({ visible, onClose }) => {
const { t, i18n } = useTranslation();
const currentLanguage = i18n.language;
const handleLanguageSelect = async (languageKey: string) => {
await saveLanguage(languageKey);
i18n.changeLanguage(languageKey);
onClose();
};
return (
<Modal
visible={visible}
transparent
animationType="fade"
onRequestClose={onClose}
>
<Pressable style={styles.overlay} onPress={onClose}>
<Pressable
style={styles.modalContainer}
onPress={(e) => e.stopPropagation()}
>
{/* 标题栏 */}
<View style={styles.header}>
<Text style={styles.title}>{t('languageModal.title')}</Text>
<TouchableOpacity onPress={onClose} style={styles.closeButton}>
<Text style={styles.closeIcon}></Text>
</TouchableOpacity>
</View>
{/* 语言列表 */}
<View style={styles.languageList}>
{LANGUAGES.map((language) => (
<TouchableOpacity
key={language.key}
style={styles.languageItem}
onPress={() => handleLanguageSelect(language.key)}
activeOpacity={0.7}
>
<Text style={styles.languageText}>{language.label}</Text>
{currentLanguage === language.key && (
<Text style={styles.checkmark}></Text>
)}
</TouchableOpacity>
))}
</View>
</Pressable>
</Pressable>
</Modal>
);
};
const styles = StyleSheet.create({
overlay: {
flex: 1,
backgroundColor: 'rgba(0, 0, 0, 0.5)',
justifyContent: 'center',
alignItems: 'center',
},
modalContainer: {
width: pxToDp(630),
backgroundColor: '#fff',
borderRadius: pxToDp(24),
overflow: 'hidden',
},
header: {
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
paddingVertical: pxToDp(32),
borderBottomWidth: pxToDp(1),
borderBottomColor: '#f0f0f0',
position: 'relative',
},
title: {
fontSize: pxToDp(32),
fontWeight: '600',
color: '#333',
},
closeButton: {
position: 'absolute',
right: pxToDp(32),
padding: pxToDp(8),
},
closeIcon: {
fontSize: pxToDp(40),
color: '#666',
fontWeight: '300',
},
languageList: {
paddingVertical: pxToDp(16),
},
languageItem: {
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
paddingHorizontal: pxToDp(40),
paddingVertical: pxToDp(32),
backgroundColor: '#fff',
},
languageText: {
fontSize: pxToDp(30),
color: '#333',
},
checkmark: {
fontSize: pxToDp(40),
color: '#FF6B35',
fontWeight: 'bold',
},
});
export default LanguageModal;

View File

@ -0,0 +1,67 @@
// components/Hello.tsx
import React, {ReactNode, useState} from 'react';
import {StyleProp, Text, TouchableOpacity, View, ViewStyle, Image} from 'react-native';
import pxToDp from '../helper/pxToDp';
import {RootNavigationProp} from '../types/RootNavigationProp'
export interface Props {
backgroundColor: string;
title: string;
textColor: string;
navigation: RootNavigationProp;
hideBack?: boolean;
customBackFunction?: () => void;
backIconType?: number;
rightView?: ReactNode;
}
const MyHeader: React.FC<Props> = props => {
const containerStyle: StyleProp<ViewStyle> = {
backgroundColor: props.backgroundColor,
height: pxToDp(88),
width: '100%',
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
paddingHorizontal: pxToDp(24),
};
let backImage = <Image
source={require('../img/Return.png')}
style={{width: pxToDp(16), height: pxToDp(28)}}
resizeMode="stretch" />
return (
<View style={containerStyle}>
{props.hideBack ? (
<View style={{width: pxToDp(56), height: pxToDp(56)}} />
) : (
<TouchableOpacity
style={{width: pxToDp(56), height: pxToDp(56), alignItems:'center', justifyContent:'center'}}
onPress={() => {
if (props.customBackFunction) {
props.customBackFunction();
} else {
props.navigation.goBack();
}
}}>
{backImage}
</TouchableOpacity>
)}
<Text
style={{
width: pxToDp(400),
fontSize: pxToDp(34),
color: props.textColor,
textAlign: 'center',
fontWeight: 'bold',
}}>
{props.title}
</Text>
<View style={{width: pxToDp(56), position: 'relative'}}>
{props.rightView}
</View>
</View>
);
};
export default MyHeader;

View File

@ -0,0 +1,41 @@
// components/Hello.tsx
import React, {useState} from 'react';
import {Button, StyleSheet, Text, View} from 'react-native';
import {StatusBar, Platform, StatusBarProps} from 'react-native';
import {useIsFocused} from '@react-navigation/native';
import helper from '../helper/helper';
export interface Props {
backgroundColor: string;
dark: Boolean;
}
const FocusAwareStatusBar = (props: StatusBarProps) => {
const isFocused = useIsFocused();
return isFocused ? <StatusBar {...props} /> : null;
};
const MyStatusbar: React.FC<Props> = props => {
const height = helper.statusBarHeight;
const data: StatusBarProps = {
backgroundColor: props.backgroundColor
? props.backgroundColor
: 'rgba(0,0,0,0)',
barStyle: props.dark ? 'dark-content' : 'light-content',
translucent: true,
};
console.log('height', height);
return (
<View
style={{
backgroundColor: props.backgroundColor,
height: height,
width: '100%',
}}>
<FocusAwareStatusBar {...data} />
</View>
);
};
// styles
const styles = StyleSheet.create({});
export default MyStatusbar;

106
src/helper/helper.js Normal file
View File

@ -0,0 +1,106 @@
import { Dimensions, StatusBar, Platform, Linking } from 'react-native';
import pxToDp from './pxToDp';
import { getStatusBarHeight } from 'react-native-safearea-height';
import * as _ from 'lodash';
import myToast, { Toast } from './myToast';
export default {
width: Dimensions.get('window').width,
height:
Platform.OS === 'ios'
? Dimensions.get('window').height
: Dimensions.get('window').height / Dimensions.get('window').width > 1.8
? Dimensions.get('window').height + getStatusBarHeight()
: Dimensions.get('window').height,
statusBarHeight: getStatusBarHeight(),
bottomTabHeight: (Platform.OS === 'ios' && Dimensions.get('window').height / Dimensions.get('window').width > 1.8?34:0) + pxToDp(98),
isIOS: Platform.OS == 'ios',
isNullOrEmpty(strings) {
return !strings || String(strings).replace(/(^s*)|(s*$)/g, '').length == 0;
},
stringToNumberStr(s) {
console.log(16, String(Number(s.replace(/[^0-9]/g, ''))));
return String(Number(s.replace(/[^0-9]/g, '')));
},
isIOSFullScreen() {
const dimen = Dimensions.get('window');
return (
Platform.OS === 'ios' &&
!Platform.isPad &&
!Platform.isTVOS &&
(dimen.height === 780 ||
dimen.width === 780 ||
dimen.height === 812 ||
dimen.width === 812 ||
dimen.height === 844 ||
dimen.width === 844 ||
dimen.height === 896 ||
dimen.width === 896 ||
dimen.height === 926 ||
dimen.width === 926)
);
},
//写一个方法传入一个数组判断数量是否是n的倍数如果不是补null
getNewArr(arr, n) {
let count = n - arr.length % n;
for (let i = 0; i < count; i++) {
arr.push(null);
}
return arr;
},
//获取随机颜色
getRandomColor() {
return '#' + ('00000' + (Math.random() * 0x1000000 << 0).toString(16)).slice(-6);
},
goPage(navigation, type, page, params) {
console.log(44, type, page, params);
if(page === '#') {
myToast.show('敬请期待','error');
return;
}
if (type === 2) {
console.log(57, '外链')
Linking.openURL(page);
} else {
console.log(60, '内链')
const json = this.toJSON(_.replace(params, /&quot;/g, '"'));
navigation.navigate(page, { ...json });
}
},
toJSON(str) {
try {
const a = JSON.parse(str);
return a;
} catch (error) {
return {};
}
},
getIntegerAndDecimal(num, type = 1) {
//type 1:去掉小数点前面的0 2:去掉0.,整数部分加小数点
let integer = Math.floor(num).toFixed(0)
let decimal = (num - integer).toFixed(1)
if (decimal === '0.0') {
return { integer, decimal: '' }
}
if (type === 1) {
decimal = decimal.replace('0', '')
} else if (type === 2) {
decimal = decimal.replace('0.', '')
integer += '.'
}
return { integer, decimal }
},
getHideString(str){
//写一个方法,判断如果是手机号,隐藏中间四位,如果是邮箱,隐藏@前面的,如果是汉字,隐藏后面的
if(!str) return '';
if(str.indexOf('@') > -1){
let arr = str.split('@');
return arr[0].substr(0,1) + '****' + arr[0].substr(arr[0].length-1) + '@' + arr[1];
}
if(str.length === 11){
return str.substr(0,3) + '****' + str.substr(7);
}
if(str.length > 1){
return str.substr(0,1) + '**';
}
},
};

37
src/helper/myToast.tsx Normal file
View File

@ -0,0 +1,37 @@
type ToastType = 'success' | 'error';
import React from 'react';
import _Toast from 'react-native-toast-message';
export default {
show(
text: string,
type: ToastType = 'success',
duration: number = 3500,
hide: () => void | undefined = () => {},
) {
// _Toast.hide();
_Toast.show({
text1: '提示',
text2: text,
type,
visibilityTime: duration,
onHide: hide,
});
},
useBlur(
navigation: any,
customFunc: (() => void) | null = null,
) {
React.useEffect(() => {
const unsubscribe = navigation.addListener('blur', () => {
// do something
_Toast.hide();
if (customFunc != null) {
customFunc();
}
});
return unsubscribe;
}, [navigation]);
},
};
export const Toast = _Toast;

14
src/helper/pxToDp.js Normal file
View File

@ -0,0 +1,14 @@
import {
Dimensions,
PixelRatio
} from 'react-native';
//视屏的宽度和设置像素转换
const deviceWidthDp = Dimensions.get('window').width;
const uiWidthPx = 750;
function pxToDp(uiElementPx,isConvert = true) {
if(!isConvert) return uiElementPx;
return Number((uiElementPx * deviceWidthDp / uiWidthPx));
}
export default pxToDp

71
src/i18n/index.ts Normal file
View File

@ -0,0 +1,71 @@
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import AsyncStorage from '@react-native-async-storage/async-storage';
import zh from './locales/zh.json';
import en from './locales/en.json';
const LANGUAGE_KEY = '@app_language';
// 语言配置类型
export interface LanguageOption {
key: string;
label: string;
value: string;
}
// 语言选项
export const LANGUAGES: LanguageOption[] = [
{
key: 'zh',
label: '中文',
value: 'zh',
},
{
key: 'en',
label: 'English',
value: 'en',
},
];
// 获取存储的语言
export const getStoredLanguage = async (): Promise<string> => {
try {
const language = await AsyncStorage.getItem(LANGUAGE_KEY);
return language || 'zh';
} catch (error) {
return 'zh';
}
};
// 保存语言选择
export const saveLanguage = async (language: string): Promise<void> => {
try {
await AsyncStorage.setItem(LANGUAGE_KEY, language);
} catch (error) {
console.error('保存语言失败:', error);
}
};
// 初始化 i18n
i18n
.use(initReactI18next)
.init({
compatibilityJSON: 'v3',
resources: {
zh: { translation: zh },
en: { translation: en },
},
lng: 'zh',
fallbackLng: 'zh',
interpolation: {
escapeValue: false,
},
});
// 从存储中加载语言设置
getStoredLanguage().then((language) => {
i18n.changeLanguage(language);
});
export default i18n;

120
src/i18n/locales/en.json Normal file
View File

@ -0,0 +1,120 @@
{
"nav": {
"scan": "Scan",
"info": "Device Info",
"dfu": "Firmware Update",
"privacy": "Privacy Policy"
},
"home": {
"title": "POWERFUN Settings",
"scan": "Scan Devices",
"privacy": "Privacy Policy",
"version": "Version v0.0.1"
},
"scan": {
"title": "Scan Devices",
"scanning": "Scanning...",
"noDevice": "No Devices Found",
"tipScanning": "(Make sure the device is powered on and awake)",
"tipBluetooth": "(Please enable Bluetooth in settings)",
"noName": "[No Name]",
"rssiUnit": "dBm"
},
"dfu": {
"title": "Firmware Update",
"preparing": "Preparing...",
"reading": "Reading...",
"bluetoothName": "Bluetooth Name",
"latestVersion": "Latest Version",
"currentVersion": "Current Version",
"upgradeStatus": "Update Status",
"stateConnecting": "Connecting…",
"stateStarting": "Initializing…",
"stateEnablingDfuMode": "Enabling DFU Mode…",
"stateUploading": "Uploading Firmware…",
"stateValidating": "Validating Firmware…",
"stateDisconnecting": "Disconnecting…",
"stateCompleted": "Update Completed",
"stateAborted": "Aborted",
"stateFailed": "Update Failed",
"stateInitializing": "Starting…",
"stateErrored": "Update Error!",
"pleaseWait": "Please Wait",
"doNotReturn": "Updating in progress, do not go back or close the app!",
"cannotUpgrade": "Cannot Update",
"hardwareNotFound": "Firmware not found for hardware version {hardware}",
"noNeedUpgrade": "No Update Needed",
"alreadyLatest": "Already the latest firmware, no update needed",
"upgradeSuccess": "Update Successful",
"upgradeSuccessMessage": "Update successful, please reconnect the device",
"upgradeFailed": "Update Failed",
"dfuFailed": "DFU Failed",
"confirm": "OK"
},
"privacy": {
"title": "Privacy Policy",
"content": "This application respects and protects the personal privacy of all users. This Privacy Policy applies only to the POWERFUN Settings App products or services provided by Wuxi Zhixingpai Sports Culture Development Co., Ltd. Please read and fully understand this policy before using our products or services.\n\n1. How We Collect and Use Your Information\n\n1. The POWERFUN Settings App does not require registration or login and does not collect any personal information.\n\n2. During your use of our products or services, we may use the following permissions:\n- Android ID\n- Storage\n- Location\n- Bluetooth\n\n3. Third-party SDK usage:\n\n(1) Tencent Bugly \nProvider: Tencent Computer Systems Company Limited \nPurpose: crash reporting and performance monitoring.\n\n(2) Aliyun OSS \nProvider: Alibaba Cloud Computing Co., Ltd. \nPurpose: storage of configuration and firmware update files.\n\n2. Updates to This Policy\n\nWe may update this policy from time to time. Changes will be published on this page.\n\n3. Contact Us\n\nEmail: bike99@qq.com\n\nWuxi Zhixingpai Sports Culture Development Co., Ltd. \nEffective date: July 1, 2019"
},
"settings": {
"title": "Settings",
"language": "Language",
"privacy": "Privacy Policy",
"version": "Version"
},
"languageModal": {
"title": "Language"
},
"info": {
"title": "Device Info",
"bluetoothName": "Bluetooth Name",
"idNumber": "ID Number",
"firmwareVersion": "Firmware Version",
"battery": "Battery",
"connectionStatus": "Connection Status",
"connected": "Connected",
"disconnected": "Disconnected",
"reading": "Reading...",
"power": "Power/W",
"cadence": "Cadence/RPM",
"balance": "L/R Balance/%",
"balanceHeader": "L / R",
"powerTrimTitle": "Power Trim Settings",
"currentTrim": "Current Trim",
"trimPlaceholder": "Enter 50-200",
"updateValue": "Update Value",
"calibrateButton": "Calibrate Zero",
"calibrating": "Calibrating... Waiting for device",
"firmwareUpgrade": "Firmware Update",
"readingInfo": "Reading information...",
"readSuccess": "Read successfully!",
"writingTrim": "Writing power trim...",
"trimUpdateSuccess": "Power trim updated successfully!",
"disconnectTitle": "Notice",
"disconnectMessage": "Device disconnected, please reconnect",
"reconnectMessage": "Please reconnect the device",
"confirm": "OK",
"trimRangeAlert": "Power trim adjusts the power meter's high and low deviation. Default value is 100%. Adjustable range is 50%-200%. Please enter a number between 50 and 200 without the % symbol. Click the button below to update the power meter after entering.",
"deviceNotConnected": "Device not connected",
"writeFailed": "Write failed",
"calibrationSuccess": "Calibration Successful",
"calibrationValue": "Calibration Value",
"calibrationError": "Calibration Error",
"calibrationTimeout": "Device not responding, please try again",
"calibrationFormatError": "Invalid response format from device",
"calibrationSendError": "Failed to send calibration command",
"error": "Error"
}
}

120
src/i18n/locales/zh.json Normal file
View File

@ -0,0 +1,120 @@
{
"nav": {
"scan": "搜索",
"info": "设备信息",
"dfu": "固件升级",
"privacy": "隐私协议"
},
"home": {
"title": "POWERFUN设置",
"scan": "搜索设备",
"privacy": "隐私协议",
"version": "版本号 v0.0.1"
},
"scan": {
"title": "搜索设备",
"scanning": "搜索中...",
"noDevice": "暂无设备",
"tipScanning": "(请确保设备有电且被唤醒)",
"tipBluetooth": "(请在设置中打开蓝牙)",
"noName": "[无名称]",
"rssiUnit": "dBm"
},
"dfu": {
"title": "固件升级",
"preparing": "准备中...",
"reading": "读取中...",
"bluetoothName": "蓝牙名称",
"latestVersion": "最新版本",
"currentVersion": "当前版本",
"upgradeStatus": "升级状态",
"stateConnecting": "连接中…",
"stateStarting": "初始化中…",
"stateEnablingDfuMode": "启用 DFU 模式…",
"stateUploading": "上传固件中…",
"stateValidating": "校验固件…",
"stateDisconnecting": "断开连接…",
"stateCompleted": "升级完成",
"stateAborted": "已取消",
"stateFailed": "升级失败",
"stateInitializing": "启动中…",
"stateErrored": "升级出错!",
"pleaseWait": "请稍候",
"doNotReturn": "正在升级,请勿返回或关闭应用!",
"cannotUpgrade": "无法升级",
"hardwareNotFound": "未找到硬件版本 {hardware} 的固件",
"noNeedUpgrade": "无需升级",
"alreadyLatest": "已是最新固件,无需升级",
"upgradeSuccess": "升级成功",
"upgradeSuccessMessage": "升级成功,请重连设备",
"upgradeFailed": "升级失败",
"dfuFailed": "DFU失败",
"confirm": "确认"
},
"privacy": {
"title": "隐私协议",
"content": "本应用尊重并保护所有使用服务用户的个人隐私权。本隐私政策仅适用于无锡执行派体育文化发展有限公司的 POWERFUN 设置 APP 产品或服务。请在使用我们的产品或服务前,仔细阅读并了解本隐私政策。\n\n一、我们如何收集和使用您的信息\n\n1. POWERFUN 设置 APP 不需要注册和登录,也不会收集任何关于个人的信息。\n\n2. 在您使用我司产品或服务过程中,我们可能会使用以下权限和信息:\n- Android ID用于第三方或我们分析错误信息。\n- 存储权限:用于管理本地缓存。\n- 位置权限:用于设备产品与 APP 蓝牙连接。\n- 蓝牙权限:用于设备产品与 APP 蓝牙连接。\n\n3. 关于第三方 SDK 使用说明:\n\n1第三方 SDK 名称:腾讯 Bugly \n提供方深圳市腾讯计算机系统有限公司 \n收集类型系统版本、设备 ID、手机型号、网络状态、系统设置、网络与 WiFi 信息、手机状态、系统日志等。 \n使用目的用于监控应用性能与稳定性收集崩溃报告和使用数据以帮助我们识别并修复问题。\n\n2第三方 SDK 名称Aliyun OSS \n提供方阿里云计算有限公司 \n使用目的用于存储应用运行必要的配置和固件升级文件确保数据可靠存储。\n\n二、本政策如何更新\n\n我们的隐私政策可能会根据需求进行变更。未经您明确同意我们不会削减您依据隐私政策应享有的权利。任何变更我们将在本页面公布。对于重大变更我们会提供更为显著的通知。\n\n重大变更包括但不限于\n- 服务模式发生重大变化(如用户信息处理目的、类型、方式等)。\n- 在所有权或组织架构方面发生变更(如业务调整、破产并购等)。\n- 用户信息安全影响评估报告显示存在高风险。\n\n三、如何联系我们\n\n如果您对本隐私政策有任何疑问、意见或建议可通过以下方式与我们联系\n电子邮件bike99@qq.com\n\n一般情况下我们将在三十天内回复。\n\n无锡执行派体育文化发展有限公司 \n本政策自 2019 年 7 月 1 日起生效"
},
"settings": {
"title": "设置",
"language": "软件语言",
"privacy": "隐私协议",
"version": "版本号"
},
"languageModal": {
"title": "软件语言"
},
"info": {
"title": "设备信息",
"bluetoothName": "蓝牙名称",
"idNumber": "ID号",
"firmwareVersion": "固件版本",
"battery": "电量",
"connectionStatus": "连接状态",
"connected": "已连接",
"disconnected": "未连接",
"reading": "读取中...",
"power": "功率/W",
"cadence": "踏频/RPM",
"balance": "左右平衡/%",
"balanceHeader": "L / R",
"powerTrimTitle": "功率微调设置",
"currentTrim": "当前微调",
"trimPlaceholder": "输入50-200",
"updateValue": "更新数值",
"calibrateButton": "校准归零",
"calibrating": "校准中...等待设备反应",
"firmwareUpgrade": "固件升级",
"readingInfo": "正在读取信息...",
"readSuccess": "读取成功!",
"writingTrim": "正在写入功率微调...",
"trimUpdateSuccess": "功率微调更新成功!",
"disconnectTitle": "提示",
"disconnectMessage": "设备已断开,请重新连接设备",
"reconnectMessage": "请重新连接设备",
"confirm": "确定",
"trimRangeAlert": "功率微调可调整功率计的高低偏差默认值100%。可调整的范围是50%-200%。请输入50至200的纯数字不需要包含%符号。输入后点击下方按钮更新进功率计设备。",
"deviceNotConnected": "设备未连接",
"writeFailed": "写入失败",
"calibrationSuccess": "校准成功",
"calibrationValue": "校准值",
"calibrationError": "校准错误",
"calibrationTimeout": "设备未响应,请重试",
"calibrationFormatError": "设备返回数据格式错误",
"calibrationSendError": "发送校准命令失败",
"error": "错误"
}
}

BIN
src/img/Return.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 858 B

BIN
src/img/Return2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 729 B

BIN
src/img/Search.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

BIN
src/img/Settings.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
src/img/_Versionnumber.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -0,0 +1,4 @@
import type { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { RootStackParamList } from "../../App";
export type RootNavigationProp = NativeStackNavigationProp<RootStackParamList>;

View File

@ -966,7 +966,7 @@
"@babel/types" "^7.4.4"
esutils "^2.0.2"
"@babel/runtime@^7.25.0":
"@babel/runtime@^7.25.0", "@babel/runtime@^7.27.6", "@babel/runtime@^7.28.4":
version "7.28.4"
resolved "https://registry.npmjs.org/@babel/runtime/-/runtime-7.28.4.tgz"
integrity sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ==
@ -1359,6 +1359,13 @@
"@nodelib/fs.scandir" "2.1.5"
fastq "^1.6.0"
"@react-native-async-storage/async-storage@^2.2.0":
version "2.2.0"
resolved "https://repo.huaweicloud.com/repository/npm/@react-native-async-storage/async-storage/-/async-storage-2.2.0.tgz#a3aa565253e46286655560172f4e366e8969f5ad"
integrity sha512-gvRvjR5JAaUZF8tv2Kcq/Gbt3JHwbKFYfmb445rhOj6NUMx3qPLixmDx5pZAyb9at1bYvJ4/eTUipU5aki45xw==
dependencies:
merge-options "^3.0.4"
"@react-native-community/cli-clean@20.0.0":
version "20.0.0"
resolved "https://registry.npmjs.org/@react-native-community/cli-clean/-/cli-clean-20.0.0.tgz"
@ -1880,6 +1887,11 @@
resolved "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz"
integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==
"@types/lodash@^4.17.21":
version "4.17.21"
resolved "https://repo.huaweicloud.com/repository/npm/@types/lodash/-/lodash-4.17.21.tgz#b806831543d696b14f8112db600ea9d3a1df6ea4"
integrity sha512-FOvQ0YPD5NOfPgMzJihoT+Za5pdkDJWcbpuj1DjaKZIr/gxodQjY/uWEFlTNqW2ugXHUiL8lRQgw63dzKHZdeQ==
"@types/node@*":
version "24.5.2"
resolved "https://registry.npmjs.org/@types/node/-/node-24.5.2.tgz"
@ -3753,6 +3765,13 @@ html-escaper@^2.0.0:
resolved "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz"
integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==
html-parse-stringify@^3.0.1:
version "3.0.1"
resolved "https://repo.huaweicloud.com/repository/npm/html-parse-stringify/-/html-parse-stringify-3.0.1.tgz#dfc1017347ce9f77c8141a507f233040c59c55d2"
integrity sha512-KknJ50kTInJ7qIScF3jeaFRpMpE8/lfiTdzf/twXyPBLAGrLRTmkz3AdTnKeh40X8k9L2fdYwEp/42WGXIRGcg==
dependencies:
void-elements "3.1.0"
http-errors@2.0.0:
version "2.0.0"
resolved "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz"
@ -3777,6 +3796,13 @@ human-signals@^2.1.0:
resolved "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz"
integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==
i18next@^25.7.3:
version "25.7.3"
resolved "https://repo.huaweicloud.com/repository/npm/i18next/-/i18next-25.7.3.tgz#88bf15b414012a53ca87b9d408108aa81cb627cc"
integrity sha512-2XaT+HpYGuc2uTExq9TVRhLsso+Dxym6PWaKpn36wfBmTI779OQ7iP/XaZHzrnGyzU4SHpFrTYLKfVyBfAhVNA==
dependencies:
"@babel/runtime" "^7.28.4"
iconv-lite@0.4.24:
version "0.4.24"
resolved "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz"
@ -4007,6 +4033,11 @@ is-path-inside@^3.0.3:
resolved "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz"
integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==
is-plain-obj@^2.1.0:
version "2.1.0"
resolved "https://repo.huaweicloud.com/repository/npm/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287"
integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==
is-regex@^1.2.1:
version "1.2.1"
resolved "https://registry.npmjs.org/is-regex/-/is-regex-1.2.1.tgz"
@ -4761,6 +4792,13 @@ memoize-one@^5.0.0:
resolved "https://registry.npmjs.org/memoize-one/-/memoize-one-5.2.1.tgz"
integrity sha512-zYiwtZUcYyXKo/np96AGZAckk+FWWsUdJ3cHGGmld7+AhvcWmQyGCYUh1hc4Q/pkOhb65dQR/pqCyK0cOaHz4Q==
merge-options@^3.0.4:
version "3.0.4"
resolved "https://repo.huaweicloud.com/repository/npm/merge-options/-/merge-options-3.0.4.tgz#84709c2aa2a4b24c1981f66c179fe5565cc6dbb7"
integrity sha512-2Sug1+knBjkaMsMgf1ctR1Ujx+Ayku4EdJN4Z+C2+JzoeF7A3OZ9KM2GY0CpQS51NR61LTurMJrRKPhSs3ZRTQ==
dependencies:
is-plain-obj "^2.1.0"
merge-stream@^2.0.0:
version "2.0.0"
resolved "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz"
@ -5455,6 +5493,15 @@ react-freeze@^1.0.0:
resolved "https://registry.npmjs.org/react-freeze/-/react-freeze-1.0.4.tgz"
integrity sha512-r4F0Sec0BLxWicc7HEyo2x3/2icUTrRmDjaaRyzzn+7aDyFZliszMDOgLVwSnQnYENOlL1o569Ze2HZefk8clA==
react-i18next@^16.5.0:
version "16.5.0"
resolved "https://repo.huaweicloud.com/repository/npm/react-i18next/-/react-i18next-16.5.0.tgz#107e4323742344a2f8792feb905cea551da6fd2c"
integrity sha512-IMpPTyCTKxEj8klCrLKUTIUa8uYTd851+jcu2fJuUB9Agkk9Qq8asw4omyeHVnOXHrLgQJGTm5zTvn8HpaPiqw==
dependencies:
"@babel/runtime" "^7.27.6"
html-parse-stringify "^3.0.1"
use-sync-external-store "^1.6.0"
react-is@^16.13.1:
version "16.13.1"
resolved "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz"
@ -5470,6 +5517,11 @@ react-is@^19.1.0:
resolved "https://registry.npmjs.org/react-is/-/react-is-19.1.1.tgz"
integrity sha512-tr41fA15Vn8p4X9ntI+yCyeGSf1TlYaY5vlTZfQmeLBrFo3psOPX6HhTDnFNL9uj3EhP0KAQ80cugCl4b4BERA==
react-native-device-info@^15.0.1:
version "15.0.1"
resolved "https://repo.huaweicloud.com/repository/npm/react-native-device-info/-/react-native-device-info-15.0.1.tgz#8a2716861bb8e491e0627f326bcc007c77d2e8f6"
integrity sha512-U5waZRXtT3l1SgZpZMlIvMKPTkFZPH8W7Ks6GrJhdH723aUIPxjVer7cRSij1mvQdOAAYFJV/9BDzlC8apG89A==
react-native-fs@^2.20.0:
version "2.20.0"
resolved "https://registry.npmjs.org/react-native-fs/-/react-native-fs-2.20.0.tgz"
@ -5488,6 +5540,11 @@ react-native-safe-area-context@^5.6.1:
resolved "https://registry.npmjs.org/react-native-safe-area-context/-/react-native-safe-area-context-5.6.1.tgz"
integrity sha512-/wJE58HLEAkATzhhX1xSr+fostLsK8Q97EfpfMDKo8jlOc1QKESSX/FQrhk7HhQH/2uSaox4Y86sNaI02kteiA==
react-native-safearea-height@^1.0.8:
version "1.0.8"
resolved "https://registry.npmmirror.com/react-native-safearea-height/-/react-native-safearea-height-1.0.8.tgz#efa2cecc2dfb2368288c435603ade3ee9c695479"
integrity sha512-nAACsA6HwbMI5zUKHUy4IOvqrohA2AFYB31Yhv6JOXbok6S7VOjOWJZNJx4dllECREon254Y2ZlqeVGUb2eqgQ==
react-native-screens@^4.16.0:
version "4.16.0"
resolved "https://registry.npmjs.org/react-native-screens/-/react-native-screens-4.16.0.tgz"
@ -5497,6 +5554,11 @@ react-native-screens@^4.16.0:
react-native-is-edge-to-edge "^1.2.1"
warn-once "^0.1.0"
react-native-toast-message@^2.3.3:
version "2.3.3"
resolved "https://repo.huaweicloud.com/repository/npm/react-native-toast-message/-/react-native-toast-message-2.3.3.tgz#e301508d386a9902ff6b4559ecc6674f8cfdf97a"
integrity sha512-4IIUHwUPvKHu4gjD0Vj2aGQzqPATiblL1ey8tOqsxOWRPGGu52iIbL8M/mCz4uyqecvPdIcMY38AfwRuUADfQQ==
react-native-vector-icons@^10.3.0:
version "10.3.0"
resolved "https://registry.npmjs.org/react-native-vector-icons/-/react-native-vector-icons-10.3.0.tgz"
@ -6377,6 +6439,11 @@ use-sync-external-store@^1.5.0:
resolved "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.5.0.tgz"
integrity sha512-Rb46I4cGGVBmjamjphe8L/UnvJD+uPPtTkNvX5mZgqdbavhI4EbgIWJiIHXJ8bc/i9EQGPRh4DwEURJ552Do0A==
use-sync-external-store@^1.6.0:
version "1.6.0"
resolved "https://repo.huaweicloud.com/repository/npm/use-sync-external-store/-/use-sync-external-store-1.6.0.tgz#b174bfa65cb2b526732d9f2ac0a408027876f32d"
integrity sha512-Pp6GSwGP/NrPIrxVFAIkOQeyw8lFenOHijQWkUTrDvrF4ALqylP2C/KCkeS9dpUM3KvYRQhna5vt7IL95+ZQ9w==
utf8@^3.0.0:
version "3.0.0"
resolved "https://registry.npmjs.org/utf8/-/utf8-3.0.0.tgz"
@ -6411,6 +6478,11 @@ vlq@^1.0.0:
resolved "https://registry.npmjs.org/vlq/-/vlq-1.0.1.tgz"
integrity sha512-gQpnTgkubC6hQgdIcRdYGDSDc+SaujOdyesZQMv6JlfQee/9Mp0Qhnys6WxDWvQnL5WZdT7o2Ul187aSt0Rq+w==
void-elements@3.1.0:
version "3.1.0"
resolved "https://repo.huaweicloud.com/repository/npm/void-elements/-/void-elements-3.1.0.tgz#614f7fbf8d801f0bb5f0661f5b2f5785750e4f09"
integrity sha512-Dhxzh5HZuiHQhbvTW9AMetFfBHDMYpo23Uo9btPXgdYP+3T5S+p+jgNy7spra+veYhBP2dCSgxR/i2Y02h5/6w==
walker@^1.0.7, walker@^1.0.8:
version "1.0.8"
resolved "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz"