refactor: 更新 Android 资源保留策略

- 移除不再使用的 React Native 新应用屏幕相关资源
- 添加新的二维码扫描图标资源
这个提交包含在:
xuqm 2025-07-15 14:47:02 +08:00
父节点 bf61fdc1ac
当前提交 4c54e8ba98
共有 33 个文件被更改,包括 1142 次插入17 次删除

查看文件

@ -1,6 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> <manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<application <application
android:name=".MainApplication" android:name=".MainApplication"

文件差异因一行或多行过长而隐藏

文件差异因一行或多行过长而隐藏

二进制文件未显示。

之前

宽度:  |  高度:  |  大小: 64 KiB

二进制文件未显示。

之前

宽度:  |  高度:  |  大小: 63 KiB

二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 1.5 KiB

二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 3.5 KiB

二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 6.9 KiB

查看文件

@ -1,4 +1,4 @@
__d(function(g,r,i,a,m,e,d){var t=r(d[0]),n=r(d[1]),p=t(r(d[2]));n.AppRegistry.registerComponent(r(d[3]).Apps.Hospital,function(){return p.default})},10000000,[5,3,10000001,491]); __d(function(g,r,i,a,m,e,d){var t=r(d[0]),n=r(d[1]),p=t(r(d[2]));n.AppRegistry.registerComponent(r(d[3]).Apps.Hospital,function(){return p.default})},10000000,[5,3,10000001,491]);
__d(function(g,r,i,a,m,e,d){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=r(d[0]),n=r(d[1]);var o=t.StyleSheet.create({container:{flex:1}});e.default=function(){var l='dark'===(0,t.useColorScheme)();return(0,n.jsxs)(t.View,{style:o.container,children:[(0,n.jsx)(t.StatusBar,{barStyle:l?'light-content':'dark-content'}),(0,n.jsx)(t.View,{style:{height:100}}),(0,n.jsx)(t.Text,{children:"\u4e92\u8054\u7f51\u533b\u9662"}),(0,n.jsx)(t.Button,{title:'\u8fd4\u56de',onPress:function(){(0,r(d[2]).pop)()}})]})}},10000001,[3,243,491]); __d(function(g,r,i,a,m,e,d){var t=r(d[0]);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=r(d[1]),o=t(r(d[2])),s=r(d[3]);var l=n.StyleSheet.create({container:{flex:1}});e.default=function(){var t='dark'===(0,n.useColorScheme)();return(0,s.jsxs)(n.View,{style:l.container,children:[(0,s.jsx)(n.StatusBar,{barStyle:t?'light-content':'dark-content'}),(0,s.jsx)(n.View,{style:{height:100}}),(0,s.jsx)(n.Text,{children:"\u4e92\u8054\u7f51\u533b\u9662"}),(0,s.jsx)(n.Button,{title:'\u8fd4\u56de',onPress:function(){(0,r(d[4]).pop)()}}),(0,s.jsx)(n.View,{style:{height:15}}),(0,s.jsx)(n.Button,{title:'Toast',onPress:function(){(0,r(d[5]).showMessage)('\u4e92\u8054\u7f51\u533b\u9662\u5f39\u51fatoast','info','common\u5411\u4e0b\u517c\u5bb9')}}),(0,s.jsx)(o.default,{})]})}},10000001,[5,3,503,243,491,502]);
__r(108); __r(108);
__r(10000000); __r(10000000);

查看文件

@ -1 +1 @@
<resources xmlns:tools="http://schemas.android.com/tools" tools:keep="@drawable/node_modules_reactnative_newappscreen_src_assets_reactdark,@drawable/node_modules_reactnative_newappscreen_src_assets_reactlight" /> <resources xmlns:tools="http://schemas.android.com/tools" tools:keep="@drawable/src_app_resource_images_icon_sign_scan" />

查看文件

@ -1,4 +1,4 @@
__d(function(g,r,i,a,m,e,d){var n=r(d[0]),t=r(d[1]),p=n(r(d[2]));t.AppRegistry.registerComponent(r(d[3]).Apps.Ywq,function(){return p.default})},10000000,[5,3,10000001,491]); __d(function(g,r,i,a,m,e,d){var n=r(d[0]),t=r(d[1]),p=n(r(d[2]));t.AppRegistry.registerComponent(r(d[3]).Apps.Ywq,function(){return p.default})},10000000,[5,3,10000001,491]);
__d(function(g,r,i,a,m,e,d){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=r(d[0]),n=r(d[1]);var o=t.StyleSheet.create({container:{flex:1}});e.default=function(){var l='dark'===(0,t.useColorScheme)();return(0,n.jsxs)(t.View,{style:o.container,children:[(0,n.jsx)(t.StatusBar,{barStyle:l?'light-content':'dark-content'}),(0,n.jsx)(t.View,{style:{height:100}}),(0,n.jsx)(t.Button,{title:'onConfirm',onPress:function(){}})]})}},10000001,[3,243]); __d(function(g,r,i,a,m,e,d){var t=r(d[0]);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=r(d[1]),o=t(r(d[2])),s=r(d[3]);var l=n.StyleSheet.create({container:{flex:1}});e.default=function(){var t='dark'===(0,n.useColorScheme)();return(0,s.jsxs)(n.View,{style:l.container,children:[(0,s.jsx)(n.StatusBar,{barStyle:t?'light-content':'dark-content'}),(0,s.jsx)(n.View,{style:{height:100}}),(0,s.jsx)(n.Button,{title:'onConfirm',onPress:function(){}}),(0,s.jsx)(n.View,{style:{height:15}}),(0,s.jsx)(n.Button,{title:'Toast',onPress:function(){(0,r(d[4]).showMessage)('\u533b\u7f51\u7b7e\u5f39\u51fatoast-error','error')}}),(0,s.jsx)(o.default,{})]})}},10000001,[5,3,503,243,502]);
__r(108); __r(108);
__r(10000000); __r(10000000);

查看文件

@ -22,15 +22,15 @@ class MainApplication : Application(), ReactApplication {
} }
override fun getJSMainModuleName(): String = override fun getJSMainModuleName(): String =
if (BuildConfig.BUILD_TYPE == "debug") "index" else "commom" if (getUseDeveloperSupport()) "index" else "commom"
override fun getBundleAssetName(): String = override fun getBundleAssetName(): String =
if (BuildConfig.BUILD_TYPE == "debug") "index.android.bundle" else "common.android.bundle" if (getUseDeveloperSupport()) "index.android.bundle" else "common.android.bundle"
override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED override val isNewArchEnabled: Boolean = true
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED override val isHermesEnabled: Boolean = true
} }
override val reactHost: ReactHost override val reactHost: ReactHost

查看文件

@ -10,7 +10,7 @@
# Specifies the JVM arguments used for the daemon process. # Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings. # The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx512m -XX:MaxMetaspaceSize=256m # Default value: -Xmx512m -XX:MaxMetaspaceSize=256m
org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=1g
# When configured, Gradle will run in incubating parallel mode. # When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit # This option should only be used with decoupled projects. More details, visit

文件差异因一行或多行过长而隐藏

文件差异因一行或多行过长而隐藏

二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 1.5 KiB

二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 3.5 KiB

二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 6.9 KiB

查看文件

@ -0,0 +1,4 @@
__d(function(g,r,i,a,m,e,d){var t=r(d[0]),n=r(d[1]),p=t(r(d[2]));n.AppRegistry.registerComponent(r(d[3]).Apps.Hospital,function(){return p.default})},10000000,[5,3,10000001,491]);
__d(function(g,r,i,a,m,e,d){var t=r(d[0]);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=r(d[1]),o=t(r(d[2])),s=r(d[3]);var l=n.StyleSheet.create({container:{flex:1}});e.default=function(){var t='dark'===(0,n.useColorScheme)();return(0,s.jsxs)(n.View,{style:l.container,children:[(0,s.jsx)(n.StatusBar,{barStyle:t?'light-content':'dark-content'}),(0,s.jsx)(n.View,{style:{height:100}}),(0,s.jsx)(n.Text,{children:"\u4e92\u8054\u7f51\u533b\u9662"}),(0,s.jsx)(n.Button,{title:'\u8fd4\u56de',onPress:function(){(0,r(d[4]).pop)()}}),(0,s.jsx)(n.View,{style:{height:15}}),(0,s.jsx)(n.Button,{title:'Toast',onPress:function(){(0,r(d[5]).showMessage)('\u4e92\u8054\u7f51\u533b\u9662\u5f39\u51fatoast','info','common\u5411\u4e0b\u517c\u5bb9')}}),(0,s.jsx)(o.default,{})]})}},10000001,[5,3,503,243,491,502]);
__r(108);
__r(10000000);

查看文件

@ -0,0 +1 @@
<resources xmlns:tools="http://schemas.android.com/tools" tools:keep="@drawable/src_app_resource_images_icon_sign_scan" />

查看文件

@ -0,0 +1,4 @@
__d(function(g,r,i,a,m,e,d){var n=r(d[0]),t=r(d[1]),p=n(r(d[2]));t.AppRegistry.registerComponent(r(d[3]).Apps.Ywq,function(){return p.default})},10000000,[5,3,10000001,491]);
__d(function(g,r,i,a,m,e,d){var t=r(d[0]);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=r(d[1]),o=t(r(d[2])),s=r(d[3]);var l=n.StyleSheet.create({container:{flex:1}});e.default=function(){var t='dark'===(0,n.useColorScheme)();return(0,s.jsxs)(n.View,{style:l.container,children:[(0,s.jsx)(n.StatusBar,{barStyle:t?'light-content':'dark-content'}),(0,s.jsx)(n.View,{style:{height:100}}),(0,s.jsx)(n.Button,{title:'onConfirm',onPress:function(){}}),(0,s.jsx)(n.View,{style:{height:15}}),(0,s.jsx)(n.Button,{title:'Toast',onPress:function(){(0,r(d[4]).showMessage)('\u533b\u7f51\u7b7e\u5f39\u51fatoast-error','error')}}),(0,s.jsx)(o.default,{})]})}},10000001,[5,3,503,243,502]);
__r(108);
__r(10000000);

文件差异因一行或多行过长而隐藏

查看文件

@ -8,10 +8,10 @@
"lint": "eslint .", "lint": "eslint .",
"start": "react-native start", "start": "react-native start",
"test": "jest", "test": "jest",
"build-android-common": "react-native bundle --platform android --dev false --entry-file src/common/common.ts --bundle-output ./bundle/common.android.bundle --assets-dest ./bundle --config metro.common.config.js --minify true --reset-cache", "build-android-common": "react-native bundle --platform android --dev false --entry-file src/common/common.ts --bundle-output bundle/android/common.android.bundle --assets-dest ./bundle/android --config metro.common.config.js --minify true --reset-cache",
"build-android-app": "react-native bundle --platform android --dev false --entry-file src/app/app.ts --bundle-output ./bundle/app.android.bundle --assets-dest ./bundle --config metro.main.config.js --minify true --reset-cache", "build-android-app": "react-native bundle --platform android --dev false --entry-file src/app/app.ts --bundle-output bundle/android/app.android.bundle --assets-dest ./bundle/android --config metro.main.config.js --minify true --reset-cache",
"build-android-ywq": "react-native bundle --platform android --dev false --entry-file src/ywq/ywq.ts --bundle-output ./bundle/ywq.android.bundle --assets-dest ./bundle --config metro.main.config.js --minify true --reset-cache", "build-android-ywq": "react-native bundle --platform android --dev false --entry-file src/ywq/ywq.ts --bundle-output ./bundle/android/ywq.android.bundle --assets-dest ./bundle/android --config metro.main.config.js --minify true --reset-cache",
"build-android-hospital": "react-native bundle --platform android --dev false --entry-file src/hospital/hospital.ts --bundle-output ./bundle/hospital.android.bundle --assets-dest ./bundle --config metro.main.config.js --minify true --reset-cache" "build-android-hospital": "react-native bundle --platform android --dev false --entry-file src/hospital/hospital.ts --bundle-output bundle/android/hospital.android.bundle --assets-dest ./bundle/android --config metro.main.config.js --minify true --reset-cache"
}, },
"codegenConfig": { "codegenConfig": {
"name": "SpecManager", "name": "SpecManager",
@ -27,7 +27,9 @@
"babel-plugin-module-resolver": "^5.0.2", "babel-plugin-module-resolver": "^5.0.2",
"react": "19.1.0", "react": "19.1.0",
"react-native": "0.80.1", "react-native": "0.80.1",
"react-native-storage": "^1.0.1" "react-native-device-info": "^14.0.4",
"react-native-storage": "^1.0.1",
"react-native-toast-message": "^2.3.3"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.25.2", "@babel/core": "^7.25.2",

查看文件

@ -6,7 +6,9 @@
*/ */
import { import {
Animated,
Button, Button,
Image,
StatusBar, StatusBar,
StyleSheet, StyleSheet,
useColorScheme, useColorScheme,
@ -14,6 +16,10 @@ import {
} from 'react-native'; } from 'react-native';
import * as navigation from '@common/NavigationHelper.ts'; import * as navigation from '@common/NavigationHelper.ts';
import { Apps } from '@common/NavigationHelper.ts'; import { Apps } from '@common/NavigationHelper.ts';
import ScrollView = Animated.ScrollView;
import TestNativeInfo from '@app/TestNativeInfo';
import { showMessage } from '@common/ToastHelper.ts';
import Toast from 'react-native-toast-message';
function App() { function App() {
const isDarkMode = useColorScheme() === 'dark'; const isDarkMode = useColorScheme() === 'dark';
@ -35,6 +41,24 @@ function App() {
navigation.pushByName(Apps.Ywq, {}); navigation.pushByName(Apps.Ywq, {});
}} }}
/> />
<View style={{ height: 15 }} />
<Button
title={'Toast'}
onPress={() => {
showMessage('APP页面弹出toast')
}}
/>
<ScrollView style={styles.flatContainer}>
<View style={styles.imgView}>
<Image
resizeMethod="resize"
resizeMode="contain"
source={require('@app/resource/images/icon_sign_scan.png')}
/>
<TestNativeInfo />
</View>
</ScrollView>
<Toast />
</View> </View>
); );
} }
@ -43,6 +67,16 @@ const styles = StyleSheet.create({
container: { container: {
flex: 1, flex: 1,
}, },
imgView: {
width: "100%",
},
img: {
width: "100%",
height: 600,
},
flatContainer: {
flex: 1,
},
}); });
export default App; export default App;

414
src/app/TestNativeInfo.js 普通文件
查看文件

@ -0,0 +1,414 @@
import React, {Component, useCallback, memo} from 'react';
import {
ScrollView,
StyleSheet,
Text,
SafeAreaView,
View,
TouchableOpacity,
NativeModules,
} from 'react-native';
import DeviceInfo from 'react-native-device-info';
import {
getManufacturer,
getManufacturerSync,
syncUniqueId,
getUniqueId,
getUniqueIdSync,
useBatteryLevel,
useBatteryLevelIsLow,
usePowerState,
useFirstInstallTime,
useDeviceName,
useManufacturer,
useHasSystemFeature,
useIsEmulator,
useIsHeadphonesConnected,
useBrightness,
} from 'react-native-device-info';
const FunctionalComponent = () => {
const batteryLevel = useBatteryLevel();
const batteryLevelIsLow = useBatteryLevelIsLow();
const powerState = usePowerState();
const firstInstallTime = useFirstInstallTime();
const deviceName = useDeviceName();
const manufacturer = useManufacturer();
const hasSystemFeature = useHasSystemFeature('amazon.hardware.fire_tv');
const isEmulator = useIsEmulator();
const isHeadphonesConnected = useIsHeadphonesConnected();
const brightness = useBrightness();
const deviceJSON = {
batteryLevel,
batteryLevelIsLow,
powerState,
firstInstallTime,
deviceName,
manufacturer,
hasSystemFeature,
isEmulator,
isHeadphonesConnected,
brightness,
};
return (
<ScrollView>
<Text style={styles.instructions} testID="hooks tab contents">
{JSON.stringify(deviceJSON, null, ' ')}
</Text>
</ScrollView>
);
};
const ActionExtensionHeader = memo(({isActionExtension}) => {
const onDonePress = useCallback(() => {
NativeModules.ActionExtension.done();
}, []);
return isActionExtension ? (
<View style={{minHeight: 50, flexDirection: 'row', margin: 10}}>
<TouchableOpacity onPress={onDonePress}>
<View
style={{
backgroundColor: 'red',
borderRadius: 20,
minWidth: 80,
minHeight: 40,
alignContent: 'center',
justifyContent: 'center',
alignItems: 'center',
}}>
<Text>Done</Text>
</View>
</TouchableOpacity>
</View>
) : (
<View />
);
});
export default class TestNativeInfo extends Component {
constructor(props) {
super(props);
this.state = {
activeTab: 'constant',
constantdeviceinfo: this.getConstantDeviceInfo(),
asyncdeviceinfo: {},
syncdeviceinfo: this.getSyncDeviceInfo(),
};
}
getConstantDeviceInfo() {
let deviceJSON = {};
deviceJSON.deviceId = DeviceInfo.getDeviceId();
deviceJSON.bundleId = DeviceInfo.getBundleId();
deviceJSON.systemName = DeviceInfo.getSystemName();
deviceJSON.systemVersion = DeviceInfo.getSystemVersion();
deviceJSON.version = DeviceInfo.getVersion();
deviceJSON.readableVersion = DeviceInfo.getReadableVersion();
deviceJSON.buildNumber = DeviceInfo.getBuildNumber();
deviceJSON.isTablet = DeviceInfo.isTablet();
deviceJSON.appName = DeviceInfo.getApplicationName();
deviceJSON.brand = DeviceInfo.getBrand();
deviceJSON.model = DeviceInfo.getModel();
deviceJSON.deviceType = DeviceInfo.getDeviceType();
return deviceJSON;
}
getSyncDeviceInfo() {
let deviceJSON = {};
deviceJSON.uniqueId = getUniqueIdSync();
deviceJSON.manufacturer = getManufacturerSync();
deviceJSON.buildId = DeviceInfo.getBuildIdSync();
deviceJSON.isCameraPresent = DeviceInfo.isCameraPresentSync();
deviceJSON.deviceName = DeviceInfo.getDeviceNameSync();
deviceJSON.usedMemory = DeviceInfo.getUsedMemorySync();
deviceJSON.instanceId = DeviceInfo.getInstanceIdSync();
deviceJSON.installReferrer = DeviceInfo.getInstallReferrerSync();
deviceJSON.installerPackageName = DeviceInfo.getInstallerPackageNameSync();
deviceJSON.isEmulator = DeviceInfo.isEmulatorSync();
deviceJSON.fontScale = DeviceInfo.getFontScaleSync();
deviceJSON.hasNotch = DeviceInfo.hasNotch();
deviceJSON.hasDynamicIsland = DeviceInfo.hasDynamicIsland();
deviceJSON.firstInstallTime = DeviceInfo.getFirstInstallTimeSync();
deviceJSON.lastUpdateTime = DeviceInfo.getLastUpdateTimeSync();
deviceJSON.serialNumber = DeviceInfo.getSerialNumberSync();
deviceJSON.androidId = DeviceInfo.getAndroidIdSync();
deviceJSON.IpAddress = DeviceInfo.getIpAddressSync();
deviceJSON.MacAddress = DeviceInfo.getMacAddressSync(); // needs android.permission.ACCESS_WIFI_STATE
deviceJSON.phoneNumber = "DeviceInfo.getPhoneNumberSync()"; // needs android.permission.READ_PHONE_STATE
deviceJSON.ApiLevel = DeviceInfo.getApiLevelSync();
deviceJSON.carrier = DeviceInfo.getCarrierSync();
deviceJSON.totalMemory = DeviceInfo.getTotalMemorySync();
deviceJSON.maxMemory = DeviceInfo.getMaxMemorySync();
deviceJSON.totalDiskCapacity = DeviceInfo.getTotalDiskCapacitySync();
deviceJSON.totalDiskCapacityOld = DeviceInfo.getTotalDiskCapacityOldSync();
deviceJSON.freeDiskStorage = DeviceInfo.getFreeDiskStorageSync();
deviceJSON.freeDiskStorageOld = DeviceInfo.getFreeDiskStorageOldSync();
deviceJSON.batteryLevel = DeviceInfo.getBatteryLevelSync();
deviceJSON.isLandscape = DeviceInfo.isLandscapeSync();
deviceJSON.isAirplaneMode = DeviceInfo.isAirplaneModeSync();
deviceJSON.isBatteryCharging = DeviceInfo.isBatteryChargingSync();
deviceJSON.isPinOrFingerprintSet = DeviceInfo.isPinOrFingerprintSetSync();
deviceJSON.supportedAbis = DeviceInfo.supportedAbisSync();
deviceJSON.hasSystemFeature = DeviceInfo.hasSystemFeatureSync(
'android.software.webview',
);
deviceJSON.getSystemAvailableFeatures = DeviceInfo.getSystemAvailableFeaturesSync();
deviceJSON.powerState = DeviceInfo.getPowerStateSync();
deviceJSON.isLocationEnabled = DeviceInfo.isLocationEnabledSync();
deviceJSON.headphones = DeviceInfo.isHeadphonesConnectedSync();
deviceJSON.getAvailableLocationProviders = DeviceInfo.getAvailableLocationProvidersSync();
deviceJSON.bootloader = DeviceInfo.getBootloaderSync();
deviceJSON.device = DeviceInfo.getDeviceSync();
deviceJSON.display = DeviceInfo.getDisplaySync();
deviceJSON.fingerprint = DeviceInfo.getFingerprintSync();
deviceJSON.hardware = DeviceInfo.getHardwareSync();
deviceJSON.host = DeviceInfo.getHostSync();
deviceJSON.product = DeviceInfo.getProductSync();
deviceJSON.tags = DeviceInfo.getTagsSync();
deviceJSON.type = DeviceInfo.getTypeSync();
deviceJSON.baseOS = DeviceInfo.getBaseOsSync();
deviceJSON.previewSdkInt = DeviceInfo.getPreviewSdkIntSync();
deviceJSON.securityPatch = DeviceInfo.getSecurityPatchSync();
deviceJSON.codename = DeviceInfo.getCodenameSync();
deviceJSON.incremental = DeviceInfo.getIncrementalSync();
deviceJSON.brightness = DeviceInfo.getBrightnessSync();
deviceJSON.supported32BitAbis = DeviceInfo.supported32BitAbisSync();
deviceJSON.supported64BitAbis = DeviceInfo.supported64BitAbisSync();
deviceJSON.hasGms = DeviceInfo.hasGmsSync();
deviceJSON.hasHms = DeviceInfo.hasHmsSync();
deviceJSON.isMouseConnected = DeviceInfo.isMouseConnectedSync();
deviceJSON.isKeyboardConnected = DeviceInfo.isKeyboardConnectedSync();
return deviceJSON;
}
async componentDidMount() {
let deviceJSON = {};
try {
deviceJSON.uniqueId = await getUniqueId();
deviceJSON.syncUniqueId = await syncUniqueId();
deviceJSON.manufacturer = await getManufacturer();
deviceJSON.buildId = await DeviceInfo.getBuildId();
deviceJSON.isCameraPresent = await DeviceInfo.isCameraPresent();
deviceJSON.deviceName = await DeviceInfo.getDeviceName();
deviceJSON.usedMemory = await DeviceInfo.getUsedMemory();
deviceJSON.userAgent = await DeviceInfo.getUserAgent();
deviceJSON.instanceId = await DeviceInfo.getInstanceId();
deviceJSON.installReferrer = await DeviceInfo.getInstallReferrer();
deviceJSON.installerPackageName = await DeviceInfo.getInstallerPackageName();
deviceJSON.isEmulator = await DeviceInfo.isEmulator();
deviceJSON.fontScale = await DeviceInfo.getFontScale();
deviceJSON.hasNotch = await DeviceInfo.hasNotch();
deviceJSON.hasDynamicIsland = await DeviceInfo.hasDynamicIsland();
deviceJSON.firstInstallTime = await DeviceInfo.getFirstInstallTime();
deviceJSON.lastUpdateTime = await DeviceInfo.getLastUpdateTime();
deviceJSON.serialNumber = await DeviceInfo.getSerialNumber();
deviceJSON.androidId = await DeviceInfo.getAndroidId();
deviceJSON.IpAddress = await DeviceInfo.getIpAddress();
deviceJSON.MacAddress = await DeviceInfo.getMacAddress(); // needs android.permission.ACCESS_WIFI_STATE
deviceJSON.phoneNumber = "await DeviceInfo.getPhoneNumber()"; // needs android.permission.READ_PHONE_STATE
deviceJSON.ApiLevel = await DeviceInfo.getApiLevel();
deviceJSON.carrier = await DeviceInfo.getCarrier();
deviceJSON.totalMemory = await DeviceInfo.getTotalMemory();
deviceJSON.maxMemory = await DeviceInfo.getMaxMemory();
deviceJSON.totalDiskCapacity = await DeviceInfo.getTotalDiskCapacity();
deviceJSON.totalDiskCapacityOld = await DeviceInfo.getTotalDiskCapacityOld();
deviceJSON.freeDiskStorage = await DeviceInfo.getFreeDiskStorage();
deviceJSON.freeDiskStorageOld = await DeviceInfo.getFreeDiskStorageOld();
deviceJSON.batteryLevel = await DeviceInfo.getBatteryLevel();
deviceJSON.isLandscape = await DeviceInfo.isLandscape();
deviceJSON.isAirplaneMode = await DeviceInfo.isAirplaneMode();
deviceJSON.isBatteryCharging = await DeviceInfo.isBatteryCharging();
deviceJSON.isPinOrFingerprintSet = await DeviceInfo.isPinOrFingerprintSet();
deviceJSON.supportedAbis = await DeviceInfo.supportedAbis();
deviceJSON.hasSystemFeature = await DeviceInfo.hasSystemFeature(
'android.software.webview',
);
deviceJSON.getSystemAvailableFeatures = await DeviceInfo.getSystemAvailableFeatures();
deviceJSON.powerState = await DeviceInfo.getPowerState();
deviceJSON.isLocationEnabled = await DeviceInfo.isLocationEnabled();
deviceJSON.headphones = await DeviceInfo.isHeadphonesConnected();
deviceJSON.getAvailableLocationProviders = await DeviceInfo.getAvailableLocationProviders();
deviceJSON.bootloader = await DeviceInfo.getBootloader();
deviceJSON.device = await DeviceInfo.getDevice();
deviceJSON.display = await DeviceInfo.getDisplay();
deviceJSON.fingerprint = await DeviceInfo.getFingerprint();
deviceJSON.hardware = await DeviceInfo.getHardware();
deviceJSON.host = await DeviceInfo.getHost();
deviceJSON.product = await DeviceInfo.getProduct();
deviceJSON.tags = await DeviceInfo.getTags();
deviceJSON.type = await DeviceInfo.getType();
deviceJSON.baseOS = await DeviceInfo.getBaseOs();
deviceJSON.previewSdkInt = await DeviceInfo.getPreviewSdkInt();
deviceJSON.securityPatch = await DeviceInfo.getSecurityPatch();
deviceJSON.codename = await DeviceInfo.getCodename();
deviceJSON.incremental = await DeviceInfo.getIncremental();
deviceJSON.brightness = await DeviceInfo.getBrightness();
deviceJSON.supported32BitAbis = await DeviceInfo.supported32BitAbis();
deviceJSON.supported64BitAbis = await DeviceInfo.supported64BitAbis();
deviceJSON.hasGms = await DeviceInfo.hasGms();
deviceJSON.hasHms = await DeviceInfo.hasHms();
deviceJSON.synchronizedUniqueId = await DeviceInfo.syncUniqueId();
deviceJSON.isMouseConnected = await DeviceInfo.isMouseConnected();
deviceJSON.isKeyboardConnected = await DeviceInfo.isKeyboardConnected();
deviceJSON.isTabletMode = await DeviceInfo.isTabletMode();
try {
deviceJSON.deviceToken = await DeviceInfo.getDeviceToken();
} catch (e) {
console.log(
'Trouble getting device token, likely a simulator or not iOS11+',
);
}
} catch (e) {
console.log('Trouble getting device info ', e);
}
// eslint-disable-next-line react/no-did-mount-set-state
this.setState({asyncdeviceinfo: deviceJSON});
this.forceUpdate();
}
render() {
return (
<SafeAreaView style={styles.container}>
<ActionExtensionHeader
isActionExtension={this.props.isActionExtension}
/>
{this.state.activeTab === 'constant' ? (
<>
<Text style={styles.welcome}>
react-native-device-info example - constant info:
</Text>
<ScrollView>
<Text style={styles.instructions} testID="constant tab contents">
{JSON.stringify(this.state.constantdeviceinfo, null, ' ')}
</Text>
</ScrollView>
</>
) : this.state.activeTab === 'sync' ? (
<>
<Text style={styles.welcome}>
react-native-device-info example - sync info:
</Text>
<ScrollView>
<Text style={styles.instructions} testID="sync tab contents">
{JSON.stringify(this.state.syncdeviceinfo, null, ' ')}
</Text>
</ScrollView>
</>
) : this.state.activeTab === 'async' ? (
<>
<Text style={styles.welcome}>
react-native-device-info example - async info:
</Text>
<ScrollView>
<Text style={styles.instructions} testID="async tab contents">
{JSON.stringify(this.state.asyncdeviceinfo, null, ' ')}
</Text>
</ScrollView>
</>
) : this.state.activeTab === 'hooks' ? (
<>
<Text style={styles.welcome}>
react-native-device-info example - hooks:
</Text>
<FunctionalComponent />
</>
) : null}
<View style={styles.tabBar}>
<TouchableOpacity
style={styles.tab}
testID="constant button"
onPress={() => this.setState({activeTab: 'constant'})}>
<Text
style={[
styles.tabText,
this.state.activeTab === 'constant' && styles.boldText,
]}>
Constant
</Text>
</TouchableOpacity>
<TouchableOpacity
style={styles.tab}
testID="sync button"
onPress={() => this.setState({activeTab: 'sync'})}>
<Text
style={[
styles.tabText,
this.state.activeTab === 'sync' && styles.boldText,
]}>
Sync
</Text>
</TouchableOpacity>
<TouchableOpacity
style={styles.tab}
testID="async button"
onPress={() => this.setState({activeTab: 'async'})}>
<Text
style={[
styles.tabText,
this.state.activeTab === 'async' && styles.boldText,
]}>
Async
</Text>
</TouchableOpacity>
<TouchableOpacity
style={styles.tab}
testID="hooks button"
onPress={() => this.setState({activeTab: 'hooks'})}>
<Text
style={[
styles.tabText,
this.state.activeTab === 'hooks' && styles.boldText,
]}>
Hooks
</Text>
</TouchableOpacity>
</View>
</SafeAreaView>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'left',
color: '#333333',
margin: 5,
},
tabBar: {
flexDirection: 'row',
borderTopColor: '#333333',
borderTopWidth: 1,
},
tab: {
height: 50,
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
tabText: {
color: '#333333',
},
boldText: {
fontWeight: '700',
},
});

二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 1.5 KiB

二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 3.5 KiB

二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 6.9 KiB

10
src/common/ToastHelper.ts 普通文件
查看文件

@ -0,0 +1,10 @@
import Toast from 'react-native-toast-message';
import { ToastType } from 'react-native-toast-message/lib/src/types';
export const showMessage = (message: string, type?: ToastType, message2?: string) => {
Toast.show({
type: type??'success',
text1: message,
text2: message2,
});
};

查看文件

@ -1,3 +1,4 @@
import 'react'; import 'react';
import 'react-native'; import 'react-native';
import './NavigationHelper'; import '@common/NavigationHelper';
import '@common/ToastHelper.ts';

查看文件

@ -14,6 +14,8 @@ import {
View, View,
} from 'react-native'; } from 'react-native';
import { pop } from '../common/NavigationHelper.ts'; import { pop } from '../common/NavigationHelper.ts';
import { showMessage } from '@common/ToastHelper.ts';
import Toast from 'react-native-toast-message';
function Hospital() { function Hospital() {
const isDarkMode = useColorScheme() === 'dark'; const isDarkMode = useColorScheme() === 'dark';
@ -29,6 +31,14 @@ function Hospital() {
pop(); pop();
}} }}
/> />
<View style={{ height: 15 }} />
<Button
title={'Toast'}
onPress={() => {
showMessage('互联网医院弹出toast', 'info', 'common向下兼容');
}}
/>
<Toast />
</View> </View>
); );
} }

查看文件

@ -12,6 +12,8 @@ import {
useColorScheme, useColorScheme,
View, View,
} from 'react-native'; } from 'react-native';
import { showMessage } from '@common/ToastHelper.ts';
import Toast from 'react-native-toast-message';
function App() { function App() {
const isDarkMode = useColorScheme() === 'dark'; const isDarkMode = useColorScheme() === 'dark';
@ -21,6 +23,14 @@ function App() {
<StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} /> <StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
<View style={{ height: 100 }} /> <View style={{ height: 100 }} />
<Button title={'onConfirm'} onPress={() => {}} /> <Button title={'onConfirm'} onPress={() => {}} />
<View style={{ height: 15 }} />
<Button
title={'Toast'}
onPress={() => {
showMessage('医网签弹出toast-error', 'error');
}}
/>
<Toast />
</View> </View>
); );
} }

查看文件

@ -5730,6 +5730,11 @@ react-is@^19.1.0:
resolved "https://nexus-inner.51trust.com/repository/npm/react-is/-/react-is-19.1.0.tgz" resolved "https://nexus-inner.51trust.com/repository/npm/react-is/-/react-is-19.1.0.tgz"
integrity sha512-Oe56aUPnkHyyDxxkvqtd7KkdQP5uIUfHxd5XTb3wE9d/kRnZLmKbDB0GWk919tdQ+mxxPtG6EAs6RMT6i1qtHg== integrity sha512-Oe56aUPnkHyyDxxkvqtd7KkdQP5uIUfHxd5XTb3wE9d/kRnZLmKbDB0GWk919tdQ+mxxPtG6EAs6RMT6i1qtHg==
react-native-device-info@^14.0.4:
version "14.0.4"
resolved "https://nexus-inner.51trust.com/repository/npm/react-native-device-info/-/react-native-device-info-14.0.4.tgz#56b24ace9ff29a66bdfc667209086421ed6cfdce"
integrity sha512-NX0wMAknSDBeFnEnSFQ8kkAcQrFHrG4Cl0mVjoD+0++iaKrOupiGpBXqs8xR0SeJyPC5zpdPl4h/SaBGly6UxA==
react-native-storage@^1.0.1: react-native-storage@^1.0.1:
version "1.0.1" version "1.0.1"
resolved "https://nexus-inner.51trust.com/repository/npm/react-native-storage/-/react-native-storage-1.0.1.tgz" resolved "https://nexus-inner.51trust.com/repository/npm/react-native-storage/-/react-native-storage-1.0.1.tgz"
@ -5738,6 +5743,11 @@ react-native-storage@^1.0.1:
opencollective "^1.0.3" opencollective "^1.0.3"
opencollective-postinstall "^2.0.2" opencollective-postinstall "^2.0.2"
react-native-toast-message@^2.3.3:
version "2.3.3"
resolved "https://nexus-inner.51trust.com/repository/npm/react-native-toast-message/-/react-native-toast-message-2.3.3.tgz#e301508d386a9902ff6b4559ecc6674f8cfdf97a"
integrity sha512-4IIUHwUPvKHu4gjD0Vj2aGQzqPATiblL1ey8tOqsxOWRPGGu52iIbL8M/mCz4uyqecvPdIcMY38AfwRuUADfQQ==
react-native@0.80.1: react-native@0.80.1:
version "0.80.1" version "0.80.1"
resolved "https://nexus-inner.51trust.com/repository/npm/react-native/-/react-native-0.80.1.tgz" resolved "https://nexus-inner.51trust.com/repository/npm/react-native/-/react-native-0.80.1.tgz"