@unif/react-native-hms-scan 0.5.5 → 0.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  [![License](https://img.shields.io/npm/l/@unif/react-native-hms-scan.svg?color=blue)](LICENSE)
6
6
  [![Docs](https://img.shields.io/badge/docs-unif--design.github.io-orange.svg)](https://unif-design.github.io/react-native-hms-scan/)
7
7
 
8
- 华为 **HMS 统一扫码(HUAWEI Scan Kit)** 的 React Native 封装,面向 RN 0.85 新架构(Fabric + TurboModule):成品扫一扫页、headless 自定义扫码 UI、从图片识别条码 / 二维码。
8
+ 华为 **HMS 统一扫码(HUAWEI Scan Kit)** 的 React Native 封装,面向 RN 0.86.2 新架构(Fabric + TurboModule):成品扫一扫页、headless 自定义扫码 UI、从图片识别条码 / 二维码。
9
9
 
10
10
  ## 特性
11
11
 
@@ -61,6 +61,16 @@ function ScanScreen({ navigation }) {
61
61
 
62
62
  headless `<HmsScanView>`(完全自定义 UI)、图片识别 `decodeImage`、权限、平台差异 —— 见[文档站](https://unif-design.github.io/react-native-hms-scan/)。
63
63
 
64
+ ## Example 能力展厅
65
+
66
+ 仓库内的 [`example/`](example/) 是可直接运行的三能力展示应用,而非 library API 的一部分:
67
+
68
+ - **Scanner 成品页** — 配置码制、`autoConfirm`、相册选图与商品确认流。
69
+ - **HmsScanView 自定义页** — 展示由宿主管理的权限、`paused` / `continuous` / `torch`、结果和错误状态。
70
+ - **decodeImage 图片识别** — 从设备上的本地图片选择并离线解码,展示成功、空数组和 `HmsScanError`。
71
+
72
+ 运行、原生配置、平台边界和测试矩阵见 [example/README.md](example/README.md)。示例的 image-picker 与本地商品表仅用于演示,接入应用应替换为自己的选择器和业务数据。
73
+
64
74
  ## 文档
65
75
 
66
76
  - **完整文档**(安装 · 平台配置 · API · 平台差异 · 故障排查):https://unif-design.github.io/react-native-hms-scan/
@@ -71,7 +81,7 @@ headless `<HmsScanView>`(完全自定义 UI)、图片识别 `decodeImage`、权
71
81
 
72
82
  | 平台 | 支持 |
73
83
  | --- | --- |
74
- | React Native | 新架构(Fabric + TurboModule)**必须开启**;在 RN 0.85 上开发与验证 |
84
+ | React Native | 新架构(Fabric + TurboModule)**必须开启**;在 RN 0.86.2 / React 19.2.3 上开发与验证 |
75
85
  | Android | ✅ minSdkVersion ≥ 24(Android 7.0) |
76
86
  | iOS | ✅ 官方 CocoaPod `ScanKitFrameWork 1.1.2.305` + 真机 |
77
87
  | iOS Simulator | ❌ 不支持;无硬件逻辑测试使用随包 Jest mock |
@@ -1 +1,2 @@
1
+ export {};
1
2
  //# sourceMappingURL=jest.setup.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"jest.setup.d.ts","sourceRoot":"","sources":["../../jest.setup.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"jest.setup.d.ts","sourceRoot":"","sources":["../../jest.setup.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unif/react-native-hms-scan",
3
- "version": "0.5.5",
3
+ "version": "0.5.6",
4
4
  "description": "华为 HMS 统一扫码服务 React Native bridge:定制视图扫码 + 图片识别 (Scan SDK-Plus / ScanKitFrameWork,@unif 私有)",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -40,7 +40,8 @@
40
40
  "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
41
41
  "prepare": "bob build",
42
42
  "typecheck": "tsc",
43
- "test": "yarn verify:android-integration && yarn verify:ios-integration && jest",
43
+ "test": "yarn verify:integration-contracts && yarn verify:android-integration && yarn verify:ios-integration && jest",
44
+ "verify:integration-contracts": "node --test scripts/__tests__/integration-contract.test.mjs",
44
45
  "verify:android-integration": "node scripts/verify-android-integration.mjs",
45
46
  "verify:ios-integration": "node scripts/verify-ios-integration.mjs",
46
47
  "lint": "eslint \"**/*.{js,ts,tsx}\""
@@ -71,34 +72,36 @@
71
72
  "registry": "https://registry.npmjs.org/"
72
73
  },
73
74
  "devDependencies": {
75
+ "@babel/core": "^7.25.2",
74
76
  "@commitlint/config-conventional": "^20.5.0",
75
- "@eslint/js": "^9.39.0",
76
- "@react-native/babel-preset": "0.85.3",
77
- "@react-native/eslint-config": "0.85.0",
78
- "@react-native/jest-preset": "0.85.3",
77
+ "@eslint/js": "^8.57.1",
78
+ "@react-native/babel-preset": "0.86.2",
79
+ "@react-native/eslint-config": "0.86.2",
80
+ "@react-native/jest-preset": "0.86.2",
81
+ "@react-native/metro-config": "0.86.2",
79
82
  "@release-it/conventional-changelog": "^11.0.0",
80
83
  "@sbaiahmed1/react-native-blur": "^4.6.2",
81
84
  "@testing-library/react-native": "^13.3.3",
82
85
  "@types/jest": "^29.5.0",
83
86
  "@types/react": "^19.2.0",
84
87
  "@types/react-test-renderer": "^19",
85
- "@unif/react-native-design": "0.8.1",
88
+ "@unif/react-native-design": "0.24.0",
86
89
  "commitlint": "^20.5.0",
87
90
  "del-cli": "^7.0.0",
88
- "eslint": "^9.39.4",
91
+ "eslint": "^8.57.1",
89
92
  "eslint-config-prettier": "^10.1.8",
90
93
  "eslint-plugin-prettier": "^5.5.5",
91
94
  "jest": "^29.7.0",
92
95
  "prettier": "^3.8.1",
93
96
  "react": "19.2.3",
94
- "react-native": "0.85.3",
97
+ "react-native": "0.86.2",
95
98
  "react-native-builder-bob": "^0.41.0",
96
- "react-native-gesture-handler": "^2.21.0",
97
- "react-native-reanimated": "^4.0.0",
98
- "react-native-reanimated-carousel": "^5.0.0-beta.5",
99
- "react-native-safe-area-context": "^5.0.0",
99
+ "react-native-gesture-handler": "^3.1.0",
100
+ "react-native-reanimated": "^4.5.3",
101
+ "react-native-reanimated-carousel": "^5.0.0",
102
+ "react-native-safe-area-context": "^5.7.0",
100
103
  "react-native-svg": "^15.15.5",
101
- "react-native-worklets": "*",
104
+ "react-native-worklets": "^0.11.3",
102
105
  "react-test-renderer": "19.2.3",
103
106
  "release-it": "^20.0.1",
104
107
  "turbo": "^2.8.21",
@@ -181,7 +184,18 @@
181
184
  ]
182
185
  },
183
186
  "jest": {
184
- "preset": "@react-native/jest-preset",
187
+ "preset": "@unif/react-native-design/jest-preset",
188
+ "moduleNameMapper": {
189
+ "^@unif/react-native-hms-scan$": "<rootDir>/src/index.tsx",
190
+ "^@unif/react-native-hms-scan/mock$": "<rootDir>/src/mock.ts",
191
+ "^react$": "<rootDir>/node_modules/react",
192
+ "^react/(.*)$": "<rootDir>/node_modules/react/$1",
193
+ "^@unif/react-native-design$": "<rootDir>/node_modules/@unif/react-native-design",
194
+ "^react-native-gesture-handler$": "<rootDir>/node_modules/react-native-gesture-handler",
195
+ "^react-native-safe-area-context$": "<rootDir>/node_modules/react-native-safe-area-context",
196
+ "^react-native-reanimated$": "<rootDir>/node_modules/react-native-reanimated",
197
+ "^react-native-worklets$": "<rootDir>/node_modules/react-native-worklets"
198
+ },
185
199
  "modulePathIgnorePatterns": [
186
200
  "<rootDir>/example/node_modules",
187
201
  "<rootDir>/lib/"