@unif/react-native-hms-scan 0.1.0 → 0.2.1

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.
@@ -7,6 +7,7 @@
7
7
  #import "HmsScanResultMapper.h"
8
8
 
9
9
  #import <React/RCTConversions.h>
10
+ #import <React/UIView+React.h>
10
11
 
11
12
  #import <react/renderer/components/ReactNativeHmsScanSpec/ComponentDescriptors.h>
12
13
  #import <react/renderer/components/ReactNativeHmsScanSpec/EventEmitters.h>
@@ -37,21 +38,19 @@ using namespace facebook::react;
37
38
 
38
39
  #pragma mark - Codegen wiring
39
40
 
40
- + (ComponentDescriptorProvider)componentDescriptorProvider
41
- {
41
+ + (ComponentDescriptorProvider)componentDescriptorProvider {
42
42
  return concreteComponentDescriptorProvider<HmsScanViewComponentDescriptor>();
43
43
  }
44
44
 
45
- - (instancetype)initWithFrame:(CGRect)frame
46
- {
45
+ - (instancetype)initWithFrame:(CGRect)frame {
47
46
  if (self = [super initWithFrame:frame]) {
48
47
  static const auto defaultProps = std::make_shared<const HmsScanViewProps>();
49
48
  _props = defaultProps;
50
49
 
51
- _appliedContinuous = YES; // matches WithDefault<boolean, true>
50
+ _appliedContinuous = YES; // matches WithDefault<boolean, true>
52
51
  _appliedPaused = NO;
53
52
  _appliedTorch = NO;
54
- _appliedFormatsCsv = @""; // matches WithDefault<string, ''> (= all formats)
53
+ _appliedFormatsCsv = @""; // matches WithDefault<string, ''> (= all formats)
55
54
  _hasAppliedOnce = NO;
56
55
  _childAttached = NO;
57
56
 
@@ -62,20 +61,17 @@ using namespace facebook::react;
62
61
 
63
62
  #pragma mark - Scan view controller lifecycle
64
63
 
65
- - (void)buildScanViewControllerWithCsv:(NSString *)csv
66
- {
64
+ - (void)buildScanViewControllerWithCsv:(NSString *)csv {
67
65
  // (Re)create the VC. HmsCustomScanViewController takes its format set at init
68
66
  // via HmsScanOptions and exposes no setter to change it later, so a formatsCsv
69
67
  // change requires rebuilding the controller.
70
68
  [self teardownScanViewController];
71
69
 
72
70
  unsigned int formatType = [HmsScanResultMapper scanFormatTypeFromCsv:csv];
73
- HmsScanOptions *options =
74
- [[HmsScanOptions alloc] initWithScanFormatType:formatType Photo:NO];
71
+ HmsScanOptions *options = [[HmsScanOptions alloc] initWithScanFormatType:formatType Photo:NO];
75
72
 
76
- HmsCustomScanViewController *vc =
77
- [[HmsCustomScanViewController alloc] initCustomizedScanWithFormatType:options];
78
- vc.backButtonHidden = YES; // we render our own chrome from JS
73
+ HmsCustomScanViewController *vc = [[HmsCustomScanViewController alloc] initCustomizedScanWithFormatType:options];
74
+ vc.backButtonHidden = YES; // we render our own chrome from JS
79
75
  vc.customizedScanDelegate = self;
80
76
  vc.continuouslyScan = _appliedContinuous;
81
77
 
@@ -101,8 +97,7 @@ using namespace facebook::react;
101
97
  }
102
98
  }
103
99
 
104
- - (void)teardownScanViewController
105
- {
100
+ - (void)teardownScanViewController {
106
101
  if (_scanVC == nil) {
107
102
  return;
108
103
  }
@@ -114,14 +109,13 @@ using namespace facebook::react;
114
109
  _scanVC = nil;
115
110
  }
116
111
 
117
- - (void)attachChildViewController
118
- {
112
+ - (void)attachChildViewController {
119
113
  if (_scanVC == nil || _childAttached) {
120
114
  return;
121
115
  }
122
116
  UIViewController *parent = [self reactViewController];
123
117
  if (parent == nil) {
124
- return; // try again on next didMoveToWindow
118
+ return; // try again on next didMoveToWindow
125
119
  }
126
120
  [parent addChildViewController:_scanVC];
127
121
  // The view is already in our hierarchy (set as contentView); just notify.
@@ -129,8 +123,7 @@ using namespace facebook::react;
129
123
  _childAttached = YES;
130
124
  }
131
125
 
132
- - (void)detachChildViewController
133
- {
126
+ - (void)detachChildViewController {
134
127
  if (_scanVC == nil || !_childAttached) {
135
128
  return;
136
129
  }
@@ -139,8 +132,7 @@ using namespace facebook::react;
139
132
  _childAttached = NO;
140
133
  }
141
134
 
142
- - (void)didMoveToWindow
143
- {
135
+ - (void)didMoveToWindow {
144
136
  [super didMoveToWindow];
145
137
  if (self.window != nil) {
146
138
  [self attachChildViewController];
@@ -151,8 +143,7 @@ using namespace facebook::react;
151
143
 
152
144
  #pragma mark - Props
153
145
 
154
- - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
155
- {
146
+ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps {
156
147
  const auto &newViewProps = *std::static_pointer_cast<HmsScanViewProps const>(props);
157
148
 
158
149
  NSString *newCsv = [NSString stringWithUTF8String:newViewProps.formatsCsv.c_str()];
@@ -205,8 +196,7 @@ using namespace facebook::react;
205
196
  // torch directly through AVFoundation as a best-effort convenience. This is NOT
206
197
  // guaranteed to stay in sync with HUAWEI's built-in torch button, and may be a
207
198
  // no-op if HUAWEI holds an exclusive lock on the capture device's configuration.
208
- - (void)applyTorch:(BOOL)on
209
- {
199
+ - (void)applyTorch:(BOOL)on {
210
200
  BOOL available = NO;
211
201
  BOOL torchOn = [self setTorchHardwareOn:on available:&available];
212
202
  [self emitTorchStatusAvailable:available on:torchOn];
@@ -215,8 +205,7 @@ using namespace facebook::react;
215
205
  // Mutates the capture device's torch. Returns the resulting on-state and writes
216
206
  // hardware availability into `available`. Does NOT emit any event (so it can be
217
207
  // reused on teardown/recycle without firing onTorchStatus on a stale emitter).
218
- - (BOOL)setTorchHardwareOn:(BOOL)on available:(BOOL *)available
219
- {
208
+ - (BOOL)setTorchHardwareOn:(BOOL)on available:(BOOL *)available {
220
209
  AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
221
210
  BOOL isAvailable = (device != nil && device.hasTorch && device.isTorchAvailable);
222
211
  if (available != NULL) {
@@ -246,8 +235,7 @@ using namespace facebook::react;
246
235
 
247
236
  // Called by HUAWEI on every decode (repeatedly in continuous mode). `resultDic`
248
237
  // is a single result dictionary; we wrap it into the contract's top-level array.
249
- - (void)customizedScanDelegateForResult:(NSDictionary *)resultDic
250
- {
238
+ - (void)customizedScanDelegateForResult:(NSDictionary *)resultDic {
251
239
  NSDictionary *mapped = [HmsScanResultMapper scanResultFromHuaweiDict:resultDic];
252
240
  if (mapped == nil) {
253
241
  // Decoded payload had no usable value; surface as a soft error event.
@@ -260,8 +248,7 @@ using namespace facebook::react;
260
248
 
261
249
  #pragma mark - Event emitters
262
250
 
263
- - (void)emitScanResultJson:(NSString *)json
264
- {
251
+ - (void)emitScanResultJson:(NSString *)json {
265
252
  if (!_eventEmitter) {
266
253
  return;
267
254
  }
@@ -272,8 +259,7 @@ using namespace facebook::react;
272
259
  });
273
260
  }
274
261
 
275
- - (void)emitScanErrorWithCode:(NSString *)code message:(NSString *)message
276
- {
262
+ - (void)emitScanErrorWithCode:(NSString *)code message:(NSString *)message {
277
263
  if (!_eventEmitter) {
278
264
  return;
279
265
  }
@@ -284,8 +270,7 @@ using namespace facebook::react;
284
270
  });
285
271
  }
286
272
 
287
- - (void)emitTorchStatusAvailable:(BOOL)available on:(BOOL)on
288
- {
273
+ - (void)emitTorchStatusAvailable:(BOOL)available on:(BOOL)on {
289
274
  if (!_eventEmitter) {
290
275
  return;
291
276
  }
@@ -298,8 +283,7 @@ using namespace facebook::react;
298
283
 
299
284
  #pragma mark - Cleanup
300
285
 
301
- - (void)prepareForRecycle
302
- {
286
+ - (void)prepareForRecycle {
303
287
  // Reset imperative state so a recycled view re-applies props cleanly.
304
288
  // Turn the torch off WITHOUT emitting (the emitter is being torn down).
305
289
  [self setTorchHardwareOn:NO available:NULL];
@@ -312,8 +296,7 @@ using namespace facebook::react;
312
296
  [super prepareForRecycle];
313
297
  }
314
298
 
315
- - (void)dealloc
316
- {
299
+ - (void)dealloc {
317
300
  if (_scanVC != nil) {
318
301
  _scanVC.customizedScanDelegate = nil;
319
302
  }
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
 
3
- // @unif/react-native-hms-scan —— 华为 HMS 统一扫码服务 RN bridge
4
- // 能力:定制视图扫码(底层 <HmsScanView> + 成品 <Scanner> 扫一扫页)+ 图片识别(decodeImage)。
3
+ // @unif/react-native-hms-scan —— 华为 HMS 统一扫码服务 RN bridge(Fabric 新架构)
4
+ // 能力:定制视图扫码(底层 <HmsScanView> + 成品 <Scanner> 扫一扫页)+ 图片识别(decodeImage)+ 相机权限。
5
+ // 0.2.1:package.json#files 补 scripts/,修 pod install 缺 prepare-scankit-xcframework.sh(podspec prepare_command 调用)。
5
6
 
6
7
  // ── 类型与常量 ──
7
8
  export { ALL_BARCODE_FORMATS, HmsScanError } from "./types.js";
@@ -1 +1 @@
1
- {"version":3,"names":["ALL_BARCODE_FORMATS","HmsScanError","coerceFormat","coerceContentType","formatsToCsv","HmsScanView","decodeImage","getCameraPermissionStatus","requestCameraPermission","Scanner"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA;AACA;;AAEA;AACA,SACEA,mBAAmB,EACnBC,YAAY,QACP,YAAS;AAYhB;AACA,SAASC,YAAY,EAAEC,iBAAiB,EAAEC,YAAY,QAAQ,aAAU;;AAExE;AACA,SAASC,WAAW,QAAQ,kBAAe;AAG3C;AACA,SAASC,WAAW,QAAQ,kBAAe;;AAE3C;AACA,SAASC,yBAAyB,EAAEC,uBAAuB,QAAQ,kBAAe;;AAElF;AACA,SAASC,OAAO,QAAQ,sBAAmB","ignoreList":[]}
1
+ {"version":3,"names":["ALL_BARCODE_FORMATS","HmsScanError","coerceFormat","coerceContentType","formatsToCsv","HmsScanView","decodeImage","getCameraPermissionStatus","requestCameraPermission","Scanner"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA;AACA;AACA;;AAEA;AACA,SACEA,mBAAmB,EACnBC,YAAY,QACP,YAAS;AAYhB;AACA,SAASC,YAAY,EAAEC,iBAAiB,EAAEC,YAAY,QAAQ,aAAU;;AAExE;AACA,SAASC,WAAW,QAAQ,kBAAe;AAG3C;AACA,SAASC,WAAW,QAAQ,kBAAe;;AAE3C;AACA,SAASC,yBAAyB,EAAEC,uBAAuB,QAAQ,kBAAe;;AAElF;AACA,SAASC,OAAO,QAAQ,sBAAmB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EACL,mBAAmB,EACnB,YAAY,GACb,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,UAAU,EACV,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,WAAW,GACZ,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGzE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGnE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAGnF,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EACL,mBAAmB,EACnB,YAAY,GACb,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,UAAU,EACV,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,WAAW,GACZ,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGzE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGnE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAGnF,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unif/react-native-hms-scan",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
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",
@@ -24,6 +24,7 @@
24
24
  "ios",
25
25
  "*.podspec",
26
26
  "react-native.config.js",
27
+ "scripts",
27
28
  "!ios/build",
28
29
  "!android/build",
29
30
  "!android/gradle",
@@ -64,7 +65,7 @@
64
65
  "bugs": {
65
66
  "url": "https://github.com/unif-design/react-native-hms-scan/issues"
66
67
  },
67
- "homepage": "https://github.com/unif-design/react-native-hms-scan#readme",
68
+ "homepage": "https://unif-design.github.io/react-native-hms-scan/",
68
69
  "publishConfig": {
69
70
  "registry": "https://registry.npmjs.org/"
70
71
  },
@@ -72,15 +73,16 @@
72
73
  "@commitlint/config-conventional": "^20.5.0",
73
74
  "@eslint/js": "^9.39.0",
74
75
  "@gorhom/bottom-sheet": "^5.2.14",
75
- "@react-native/babel-preset": "0.85.0",
76
+ "@react-native/babel-preset": "0.85.3",
76
77
  "@react-native/eslint-config": "0.85.0",
77
- "@react-native/jest-preset": "0.85.0",
78
+ "@react-native/jest-preset": "0.85.3",
79
+ "@release-it/conventional-changelog": "^11.0.0",
78
80
  "@sbaiahmed1/react-native-blur": "^4.6.2",
79
81
  "@testing-library/react-native": "^13.3.3",
80
82
  "@types/jest": "^29.5.0",
81
83
  "@types/react": "^19.2.0",
82
84
  "@types/react-test-renderer": "^19",
83
- "@unif/react-native-design": "^0.4.35",
85
+ "@unif/react-native-design": "0.5.1",
84
86
  "commitlint": "^20.5.0",
85
87
  "del-cli": "^7.0.0",
86
88
  "eslint": "^9.39.4",
@@ -89,7 +91,7 @@
89
91
  "jest": "^29.7.0",
90
92
  "prettier": "^3.8.1",
91
93
  "react": "19.2.3",
92
- "react-native": "0.85.0",
94
+ "react-native": "0.85.3",
93
95
  "react-native-builder-bob": "^0.41.0",
94
96
  "react-native-gesture-handler": "^2.21.0",
95
97
  "react-native-reanimated": "^4.0.0",
@@ -98,6 +100,8 @@
98
100
  "react-native-svg": "^15.15.5",
99
101
  "react-native-worklets": "*",
100
102
  "react-test-renderer": "19.2.3",
103
+ "release-it": "^20.0.1",
104
+ "turbo": "^2.8.21",
101
105
  "typescript": "^6.0.2",
102
106
  "typescript-eslint": "^8.20.0"
103
107
  },
@@ -115,7 +119,8 @@
115
119
  "react-native-worklets": "*"
116
120
  },
117
121
  "workspaces": [
118
- "example"
122
+ "example",
123
+ "website"
119
124
  ],
120
125
  "packageManager": "yarn@4.11.0",
121
126
  "codegenConfig": {
@@ -144,6 +149,28 @@
144
149
  ]
145
150
  ]
146
151
  },
152
+ "release-it": {
153
+ "git": {
154
+ "commitMessage": "chore: release ${version} [skip ci]",
155
+ "tagName": "v${version}",
156
+ "requireCommits": true
157
+ },
158
+ "npm": {
159
+ "publish": true,
160
+ "skipChecks": true
161
+ },
162
+ "github": {
163
+ "release": true
164
+ },
165
+ "plugins": {
166
+ "@release-it/conventional-changelog": {
167
+ "preset": {
168
+ "name": "angular"
169
+ },
170
+ "infile": "CHANGELOG.md"
171
+ }
172
+ }
173
+ },
147
174
  "commitlint": {
148
175
  "extends": [
149
176
  "@commitlint/config-conventional"
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # 生成含 arm64-simulator 切片的 ScanKitFrameWork.xcframework(+ 资源 bundle)。
4
+ #
5
+ # 背景:华为官方 ScanKitFrameWork 1.1.2 是 2020 年前的老式 fat framework
6
+ # (arm64 = 真机 / x86_64 = Intel 模拟器,LC_VERSION_MIN_IPHONEOS 标记),
7
+ # 不含 arm64-simulator 切片。Apple Silicon(M 芯片)的 iOS 模拟器是 arm64-sim,
8
+ # 会因缺这一片而链接失败(旧 podspec 只能 EXCLUDED_ARCHS 排掉、导致模拟器编不过)。
9
+ #
10
+ # 这里用 Apple 官方 vtool 把真机 arm64 改写成 simulator 平台、补出 arm64-sim,
11
+ # 再 lipo 合并 x86_64,最后 xcodebuild -create-xcframework 打成 xcframework
12
+ # (device 片 / simulator 片分目录,fat binary 不允许同 arch 共存)。
13
+ #
14
+ # vtool 转出来的 sim 片仅用于编译/链接(CI、模拟器跑通);真机仍走 device 片。
15
+ # 模拟器上真去调摄像头硬件会崩,但模拟器本无扫码硬件场景,不影响。
16
+ #
17
+ # 由 ReactNativeHmsScan.podspec 的 prepare_command 在 pod install 时调用。
18
+ # 产物 ios/vendor/ 不入 git —— 按需生成(已生成则跳过)。
19
+ #
20
+ set -euo pipefail
21
+
22
+ OUT_DIR="ios/vendor"
23
+ XCFW="$OUT_DIR/ScanKitFrameWork.xcframework"
24
+ BUNDLE="$OUT_DIR/ScanKitFrameWorkBundle.bundle"
25
+
26
+ # 华为官方 Scan SDK-Plus iOS 工具包(scansdk-ios-tool 1.1.0.305)。
27
+ # URL 取自 ScanKitFrameWork 的 CocoaPods spec(source.http),带 10 年签名有效期。
28
+ ZIP_URL="https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_package_901_9/eb/v3/FoQltlwsS0Ge-TitlHPL3A/scansdk-ios-tool-1.1.0.305.zip?HW-CC-KV=V1&HW-CC-Date=20230321T064901Z&HW-CC-Expire=315360000&HW-CC-Sign=C23A0122B070535FDFA38C56BA62E25E6BE66582D963B8C7F5DDF4FCA5C34CFF"
29
+
30
+ # 只在 macOS 生成(需 lipo / vtool / xcodebuild);Android 等平台的 pod install 直接跳过。
31
+ if [ "$(uname)" != "Darwin" ]; then
32
+ echo "[scankit] 非 macOS,跳过 xcframework 生成"
33
+ exit 0
34
+ fi
35
+
36
+ # 已生成且两个平台切片齐全 → 跳过(避免每次 pod install 重复下载几十 MB)。
37
+ if [ -d "$XCFW/ios-arm64" ] && [ -d "$XCFW/ios-arm64_x86_64-simulator" ] && [ -d "$BUNDLE" ]; then
38
+ echo "[scankit] xcframework 已存在,跳过"
39
+ exit 0
40
+ fi
41
+
42
+ echo "[scankit] 下载华为 Scan SDK ..."
43
+ TMP="$(mktemp -d)"
44
+ trap 'rm -rf "$TMP"' EXIT
45
+ curl -fsSL "$ZIP_URL" -o "$TMP/sdk.zip"
46
+ unzip -q "$TMP/sdk.zip" -d "$TMP/sdk"
47
+
48
+ SRC_FW="$(find "$TMP/sdk" -type d -name 'ScanKitFrameWork.framework' | head -1)"
49
+ SRC_BUNDLE="$(find "$TMP/sdk" -type d -name 'ScanKitFrameWorkBundle.bundle' | head -1)"
50
+ if [ -z "$SRC_FW" ]; then
51
+ echo "[scankit] ✗ 解压后未找到 ScanKitFrameWork.framework" >&2
52
+ exit 1
53
+ fi
54
+ BIN="$SRC_FW/ScanKitFrameWork"
55
+
56
+ echo "[scankit] 拆片 + vtool 补 arm64-simulator + 组 xcframework ..."
57
+ mkdir -p "$TMP/device" "$TMP/sim"
58
+
59
+ # device:真机 arm64
60
+ cp -R "$SRC_FW" "$TMP/device/ScanKitFrameWork.framework"
61
+ lipo "$BIN" -thin arm64 -output "$TMP/device/ScanKitFrameWork.framework/ScanKitFrameWork"
62
+
63
+ # simulator:arm64(真机片经 vtool 改写成 simulator 平台 7)+ x86_64(原 Intel 模拟器片)
64
+ cp -R "$SRC_FW" "$TMP/sim/ScanKitFrameWork.framework"
65
+ lipo "$BIN" -thin arm64 -output "$TMP/a64d"
66
+ vtool -arch arm64 -set-build-version 7 13.5 13.5 -replace -output "$TMP/a64s" "$TMP/a64d"
67
+ lipo "$BIN" -thin x86_64 -output "$TMP/x86"
68
+ lipo -create "$TMP/a64s" "$TMP/x86" -output "$TMP/sim/ScanKitFrameWork.framework/ScanKitFrameWork"
69
+
70
+ mkdir -p "$OUT_DIR"
71
+ rm -rf "$XCFW"
72
+ xcodebuild -create-xcframework \
73
+ -framework "$TMP/device/ScanKitFrameWork.framework" \
74
+ -framework "$TMP/sim/ScanKitFrameWork.framework" \
75
+ -output "$XCFW"
76
+
77
+ # 资源 bundle(扫码 UI 资源),原由 ScanKitFrameWork pod 带,现随 vendored 一起放。
78
+ if [ -n "$SRC_BUNDLE" ]; then
79
+ rm -rf "$BUNDLE"
80
+ cp -R "$SRC_BUNDLE" "$BUNDLE"
81
+ fi
82
+
83
+ echo "[scankit] ✓ 生成 $XCFW(+ bundle)"
package/src/index.tsx CHANGED
@@ -1,5 +1,6 @@
1
- // @unif/react-native-hms-scan —— 华为 HMS 统一扫码服务 RN bridge
2
- // 能力:定制视图扫码(底层 <HmsScanView> + 成品 <Scanner> 扫一扫页)+ 图片识别(decodeImage)。
1
+ // @unif/react-native-hms-scan —— 华为 HMS 统一扫码服务 RN bridge(Fabric 新架构)
2
+ // 能力:定制视图扫码(底层 <HmsScanView> + 成品 <Scanner> 扫一扫页)+ 图片识别(decodeImage)+ 相机权限。
3
+ // 0.2.1:package.json#files 补 scripts/,修 pod install 缺 prepare-scankit-xcframework.sh(podspec prepare_command 调用)。
3
4
 
4
5
  // ── 类型与常量 ──
5
6
  export {