scandit-react-native-datacapture-core 8.6.1 → 8.7.0-beta.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.
- package/android/build.gradle +1 -1
- package/android/generated/java/com/facebook/fbreact/specs/NativeScanditDataCaptureCoreSpec.java +1 -1
- package/android/src/main/kotlin/com/scandit/datacapture/reactnative/core/ScanditDataCaptureCoreModuleBase.kt +2 -2
- package/android/src/main/newArch/kotlin/com/scandit/datacapture/reactnative/core/ScanditDataCaptureCoreModule.kt +2 -0
- package/android/src/main/oldArch/kotlin/com/scandit/datacapture/reactnative/core/ScanditDataCaptureCoreModule.kt +2 -0
- package/dist/core.js +6244 -3037
- package/dist/core.js.flow +5797 -845
- package/dist/core.js.map +1 -1
- package/dist/dts/core.d.ts +7134 -882
- package/dist/dts/index.d.ts +467 -44
- package/dist/index.js +354 -92
- package/dist/index.js.flow +427 -94
- package/dist/index.js.map +1 -1
- package/ios/Sources/ScanditDataCaptureCore.swift +10 -6
- package/ios/generated/ScanditReactNativeDatacaptureCoreSpec/ScanditReactNativeDatacaptureCoreSpec.h +3 -3
- package/package.json +13 -5
- package/scandit-react-native-datacapture-core.podspec +1 -1
- package/specs/NativeScanditDataCaptureCore.ts +1 -1
package/dist/index.js.flow
CHANGED
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
FrameSourceState,
|
|
25
25
|
TorchState,
|
|
26
26
|
CameraPosition,
|
|
27
|
+
CameraSettings,
|
|
27
28
|
DataCaptureOverlay as DataCaptureOverlay$1,
|
|
28
29
|
NativeCaller,
|
|
29
30
|
} from "./core";
|
|
@@ -37,8 +38,10 @@ declare export {
|
|
|
37
38
|
CameraSwitchControl,
|
|
38
39
|
ClusteringMode,
|
|
39
40
|
Color,
|
|
41
|
+
ColorFillOverlay,
|
|
40
42
|
ContextStatus,
|
|
41
43
|
Control,
|
|
44
|
+
DEFAULT_CATEGORIES,
|
|
42
45
|
DataCaptureComponent,
|
|
43
46
|
DataCaptureContext,
|
|
44
47
|
DataCaptureContextCreationOptions,
|
|
@@ -65,6 +68,10 @@ declare export {
|
|
|
65
68
|
LaserlineViewfinder,
|
|
66
69
|
LicenseInfo,
|
|
67
70
|
LocationSelection,
|
|
71
|
+
LogCategory,
|
|
72
|
+
LogLevel,
|
|
73
|
+
LogRecord,
|
|
74
|
+
LogRecordError,
|
|
68
75
|
LogoStyle,
|
|
69
76
|
MacroMode,
|
|
70
77
|
MacroModeListener,
|
|
@@ -92,6 +99,7 @@ declare export {
|
|
|
92
99
|
ScanditIconBuilder,
|
|
93
100
|
ScanditIconShape,
|
|
94
101
|
ScanditIconType,
|
|
102
|
+
ScanditLogger,
|
|
95
103
|
SelectionMode,
|
|
96
104
|
SequenceFrameSource,
|
|
97
105
|
Size,
|
|
@@ -126,12 +134,46 @@ import {
|
|
|
126
134
|
} from "react-native";
|
|
127
135
|
declare function initCoreProxy(): void;
|
|
128
136
|
declare function initCoreDefaults(): void;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* This class contains the DataCapture version getter.
|
|
140
|
+
* @since 6.5.0
|
|
141
|
+
*/
|
|
129
142
|
declare class DataCaptureVersion {
|
|
143
|
+
/**
|
|
144
|
+
* Returns the version of the Scandit Data Capture Plugin.
|
|
145
|
+
* @since 6.5.0
|
|
146
|
+
*/
|
|
130
147
|
static pluginVersion: string;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Version of the native SDK the plugin is running against.
|
|
151
|
+
*
|
|
152
|
+
* Read from the Core defaults singleton, which `initCoreDefaults()` populates from the native
|
|
153
|
+
* `DynamicDefaults` payload at import time. This used to read a flat `NativeModule.Version`
|
|
154
|
+
* constant, which native stopped exposing when the residual moved under `DynamicDefaults`
|
|
155
|
+
* (SDC-32175 / SDC-32178) — so it had been returning undefined.
|
|
156
|
+
*
|
|
157
|
+
* Returns the version of the Scandit Data Capture SDK.
|
|
158
|
+
* @since 6.5.0
|
|
159
|
+
*/
|
|
131
160
|
static sdkVersion: string;
|
|
132
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
|
|
164
|
+
* @since 6.5.0
|
|
165
|
+
*/
|
|
133
166
|
declare type DataCaptureOverlay = { ... } & Serializeable;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Listener for observing the data capture view. This listener is typically used when you want to react to orientation and size changes, e.g. to adjust view finder and scan area parameters.
|
|
170
|
+
* @since 6.5.0
|
|
171
|
+
*/
|
|
134
172
|
declare interface DataCaptureViewListener {
|
|
173
|
+
/**
|
|
174
|
+
* Invoked when the data capture view changes size or orientation.
|
|
175
|
+
* @since 6.5.0
|
|
176
|
+
*/
|
|
135
177
|
didChangeSize?: (
|
|
136
178
|
view: DataCaptureView,
|
|
137
179
|
size: Size,
|
|
@@ -152,25 +194,72 @@ declare interface DataCaptureViewProps {
|
|
|
152
194
|
*/
|
|
153
195
|
onNativeDispose?: (teardown: Promise<mixed>) => void;
|
|
154
196
|
}
|
|
197
|
+
/**
|
|
198
|
+
* [object Object],[object Object],[object Object]
|
|
199
|
+
* @since 6.5.0
|
|
200
|
+
*/
|
|
155
201
|
declare class DataCaptureView mixins React$1.Component<DataCaptureViewProps> {
|
|
156
202
|
view: BaseDataCaptureView;
|
|
157
203
|
constructor(props: DataCaptureViewProps): this;
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* The margins to use for the scan area. The margins are measured from the border of the data capture view and allow to specify a region around the border that is excluded from scanning.
|
|
207
|
+
*
|
|
208
|
+
* By default, the margins are zero and the scanning happens in the visible part of the preview.
|
|
209
|
+
*
|
|
210
|
+
* On iOS, the scan area also excludes the left and right safe area insets of the view: on each side, the larger of the margin and the inset applies. This property keeps returning the margins that were set.
|
|
211
|
+
* @since 6.5.0
|
|
212
|
+
*/
|
|
158
213
|
scanAreaMargins: MarginsWithUnit;
|
|
159
214
|
-scanAreaMargins: any;
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
|
|
218
|
+
* @since 6.5.0
|
|
219
|
+
*/
|
|
160
220
|
pointOfInterest: PointWithUnit;
|
|
161
221
|
-pointOfInterest: any;
|
|
162
|
-
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* The style of the logo which can be either the default extended “Scanning By Scandit” or a minimal “Scandit”.
|
|
225
|
+
*
|
|
226
|
+
* This property has no effect when the logo is drawn by one of the viewfinders.
|
|
227
|
+
* @since 6.8.0
|
|
228
|
+
*/
|
|
229
|
+
logoStyle: $Values<typeof LogoStyle$1>;
|
|
163
230
|
-logoStyle: any;
|
|
164
|
-
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* [object Object],[object Object],[object Object],[object Object],[object Object]
|
|
234
|
+
* @since 6.5.0
|
|
235
|
+
*/
|
|
236
|
+
logoAnchor: $Values<typeof Anchor$1>;
|
|
165
237
|
-logoAnchor: any;
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
|
|
241
|
+
* @since 6.5.0
|
|
242
|
+
*/
|
|
166
243
|
logoOffset: PointWithUnit;
|
|
167
244
|
-logoOffset: any;
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* [object Object],[object Object],[object Object]
|
|
248
|
+
* @since 6.7.0
|
|
249
|
+
*/
|
|
168
250
|
focusGesture: FocusGesture | null;
|
|
169
251
|
-focusGesture: any;
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* [object Object],[object Object],[object Object],[object Object],[object Object]
|
|
255
|
+
* @since 8.4.0
|
|
256
|
+
*/
|
|
170
257
|
zoomGestures: ZoomGesture[];
|
|
171
258
|
-zoomGestures: any;
|
|
172
259
|
|
|
173
260
|
/**
|
|
261
|
+
* [object Object],[object Object],[object Object]
|
|
262
|
+
* @since 6.7.0
|
|
174
263
|
* @deprecated Use zoomGestures instead. Will be removed in a future version.
|
|
175
264
|
*/
|
|
176
265
|
zoomGesture: ZoomGesture | null;
|
|
@@ -179,23 +268,84 @@ declare class DataCaptureView mixins React$1.Component<DataCaptureViewProps> {
|
|
|
179
268
|
* @deprecated Use zoomGestures instead. Will be removed in a future version.
|
|
180
269
|
*/
|
|
181
270
|
-zoomGesture: any;
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* When enabled, the data capture view may display notifications to inform users about update in zoom level. Defaults to *true*.
|
|
274
|
+
* @since 8.3.0
|
|
275
|
+
*/
|
|
182
276
|
shouldShowZoomNotification: boolean;
|
|
183
277
|
-shouldShowZoomNotification: any;
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Sets a custom property on this data capture view. This function is for internal use. Any features and functionality offered through this method can and will vanish without public notice from one version to the next.
|
|
281
|
+
* @since 8.3.0
|
|
282
|
+
*/
|
|
184
283
|
setProperty<T>(name: string, value: T): void;
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Adds the overlay to this data capture view. If the overlay is already part of this view, the call has no effect.
|
|
287
|
+
* @since 6.5.0
|
|
288
|
+
*/
|
|
185
289
|
addOverlay(overlay: DataCaptureOverlay): Promise<void>;
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Removes overlay from this data capture view. If the overlay is not part of this view, the call has no effect.
|
|
293
|
+
* @since 6.5.0
|
|
294
|
+
*/
|
|
186
295
|
removeOverlay(overlay: DataCaptureOverlay): Promise<void>;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Adds the listener to this data capture view.
|
|
299
|
+
*
|
|
300
|
+
* In case the same listener is already observing this instance, calling this method will not add the listener again.
|
|
301
|
+
* @since 6.5.0
|
|
302
|
+
*/
|
|
187
303
|
addListener(listener: DataCaptureViewListener): void;
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Removes a previously added listener from this data capture view.
|
|
307
|
+
*
|
|
308
|
+
* In case the listener is not currently observing this instance, calling this method has no effect.
|
|
309
|
+
* @since 6.5.0
|
|
310
|
+
*/
|
|
188
311
|
removeListener(listener: DataCaptureViewListener): void;
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Converts a point in the coordinate system of the last visible frame and maps it to a coordinate in the view.
|
|
315
|
+
*
|
|
316
|
+
* This method is thread-safe and can be called from any thread.
|
|
317
|
+
* @since 6.5.0
|
|
318
|
+
*/
|
|
189
319
|
viewPointForFramePoint(point: Point): Promise<Point>;
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Converts a quadrilateral in the coordinate system of the last visible frame and maps it to a coordinate in the view.
|
|
323
|
+
* @since 6.5.0
|
|
324
|
+
*/
|
|
190
325
|
viewQuadrilateralForFrameQuadrilateral(
|
|
191
326
|
quadrilateral: Quadrilateral
|
|
192
327
|
): Promise<Quadrilateral>;
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* [object Object],[object Object],[object Object]
|
|
331
|
+
* @since 6.8.0
|
|
332
|
+
*/
|
|
193
333
|
addControl(control: Control): Promise<void>;
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Adds the control to the data capture view at the specified anchor and with the given offset. Only one control per type can be added at any point in time, trying to add a second instance of the same control type will result in the first one being removed. Adding a control at an anchor already taken will replace the previous control there. The offset x will move the control away from the border of the data capture view horizontally, which means that controls anchored on the left will move to the right and vice-versa. Controls anchored in the center horizontally will also move to the right. The offset y will move the control away from the border of the data capture view vertically, which means that controls anchored on the top will move downward and controls anchored to the bottom will move upward. Controls anchored in the center vertically will also move upward.
|
|
337
|
+
* @since 6.22.0
|
|
338
|
+
*/
|
|
194
339
|
addControlWithAnchorAndOffset(
|
|
195
340
|
control: Control,
|
|
196
|
-
anchor: $Values<typeof Anchor>,
|
|
341
|
+
anchor: $Values<typeof Anchor$1>,
|
|
197
342
|
offset: PointWithUnit
|
|
198
343
|
): void;
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Removes the previously added control from data capture view. If the control is not part of this view, the call has no effect.
|
|
347
|
+
* @since 6.8.0
|
|
348
|
+
*/
|
|
199
349
|
removeControl(control: Control): void;
|
|
200
350
|
componentWillUnmount(): void;
|
|
201
351
|
componentDidMount(): void;
|
|
@@ -209,7 +359,7 @@ declare class DataCaptureView mixins React$1.Component<DataCaptureViewProps> {
|
|
|
209
359
|
* ```tsx
|
|
210
360
|
* const isForeground = useIsForeground();
|
|
211
361
|
* const isFocused = useIsFocused(); // from @react-navigation/native
|
|
212
|
-
* <
|
|
362
|
+
* <BarcodeCaptureAioView isActive={isFocused && isForeground} ... />
|
|
213
363
|
* ```
|
|
214
364
|
*/
|
|
215
365
|
declare function useIsForeground(): boolean;
|
|
@@ -218,9 +368,29 @@ declare type PermissionStatus =
|
|
|
218
368
|
| "denied"
|
|
219
369
|
| "not-determined"
|
|
220
370
|
| "restricted";
|
|
371
|
+
/**
|
|
372
|
+
* [object Object],[object Object],[object Object]
|
|
373
|
+
* @since 8.7.0
|
|
374
|
+
*/
|
|
221
375
|
declare interface CameraPermissionResult {
|
|
376
|
+
/**
|
|
377
|
+
* [object Object],[object Object],[object Object]
|
|
378
|
+
* @since 8.7.0
|
|
379
|
+
*/
|
|
222
380
|
hasPermission: boolean;
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* The current permission status, typed as `PermissionStatus` — a union of four string values:
|
|
384
|
+
*
|
|
385
|
+
* `granted`Camera access has been granted.`denied`Camera access has been refused. Android only; iOS cannot report a denial to JavaScript.`not-determined`Camera access has not been decided yet. Also the initial value on iOS.`restricted`Camera access has been refused and the system will not prompt again. Android only, corresponding to `NEVER_ASK_AGAIN`.
|
|
386
|
+
* @since 8.7.0
|
|
387
|
+
*/
|
|
223
388
|
permissionStatus: PermissionStatus;
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* [object Object],[object Object],[object Object]
|
|
392
|
+
* @since 8.7.0
|
|
393
|
+
*/
|
|
224
394
|
requestPermission: () => Promise<boolean>;
|
|
225
395
|
}
|
|
226
396
|
/**
|
|
@@ -236,7 +406,7 @@ declare interface CameraPermissionResult {
|
|
|
236
406
|
* On iOS this hook returns `permissionStatus: 'not-determined'` initially and
|
|
237
407
|
* optimistically flips to `'granted'` after `requestPermission()` is called.
|
|
238
408
|
* It cannot detect denials after-the-fact; consumers should treat the iOS camera-start
|
|
239
|
-
* flow as the authoritative signal (surfaced via `<
|
|
409
|
+
* flow as the authoritative signal (surfaced via `<BarcodeCaptureAioView onError={...} />`).
|
|
240
410
|
*
|
|
241
411
|
* ```tsx
|
|
242
412
|
* const { hasPermission, requestPermission } = useCameraPermission();
|
|
@@ -244,16 +414,21 @@ declare interface CameraPermissionResult {
|
|
|
244
414
|
* ```
|
|
245
415
|
*/
|
|
246
416
|
declare function useCameraPermission(): CameraPermissionResult;
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* [object Object],[object Object],[object Object]
|
|
420
|
+
* @since 8.7.0
|
|
421
|
+
*/
|
|
247
422
|
declare interface UseScanditContextOptions {
|
|
248
423
|
/**
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
* once) — passing a fresh instance every render will spam `applySettings`.
|
|
424
|
+
* [object Object],[object Object],[object Object]
|
|
425
|
+
* @since 8.7.0
|
|
252
426
|
*/
|
|
253
427
|
settings?: DataCaptureContextSettings;
|
|
254
428
|
|
|
255
429
|
/**
|
|
256
|
-
* Applied once
|
|
430
|
+
* Applied once, when the context is created natively. Later changes are ignored.
|
|
431
|
+
* @since 8.7.0
|
|
257
432
|
*/
|
|
258
433
|
creationOptions?: DataCaptureContextCreationOptions;
|
|
259
434
|
}
|
|
@@ -278,12 +453,53 @@ declare interface CameraClaim {
|
|
|
278
453
|
mode: CameraClaimMode;
|
|
279
454
|
active: boolean;
|
|
280
455
|
}
|
|
456
|
+
/**
|
|
457
|
+
* What the provider last applied to its own camera (native state latch).
|
|
458
|
+
*/
|
|
459
|
+
declare type CameraAppliedState = "on" | "standby" | "off";
|
|
460
|
+
/**
|
|
461
|
+
* Read-only snapshot of the ownership state, for diagnostics only.
|
|
462
|
+
*
|
|
463
|
+
* The engine's invariants ("one screen holds the claim", "the camera drops to
|
|
464
|
+
* Standby between screens") are otherwise invisible at runtime: ownership lives
|
|
465
|
+
* in a closure variable and Standby is a native state with no queryable
|
|
466
|
+
* counterpart on the JS side. Without this, verifying them on-device means
|
|
467
|
+
* inferring from the *absence* of a log line (SDC-33115).
|
|
468
|
+
*/
|
|
469
|
+
declare interface CameraOwnerSnapshot {
|
|
470
|
+
/**
|
|
471
|
+
* The current owner's claim mode, or null when no screen holds the claim.
|
|
472
|
+
*/
|
|
473
|
+
ownerMode: CameraClaimMode | null;
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* The last state the provider applied to its own camera.
|
|
477
|
+
*/
|
|
478
|
+
applied: CameraAppliedState;
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* True only after a fully successful acquire (both native calls confirmed).
|
|
482
|
+
*/
|
|
483
|
+
acquireSucceeded: boolean;
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* Number of mutation steps not yet drained by an apply pass.
|
|
487
|
+
*/
|
|
488
|
+
pendingSteps: number;
|
|
489
|
+
}
|
|
281
490
|
/**
|
|
282
491
|
* The ownership surface `useCameraClaim` is built on, plus camera-wide
|
|
283
492
|
* controls (torch/position) and lifecycle.
|
|
284
493
|
*/
|
|
285
494
|
declare interface CameraCoordinator {
|
|
286
495
|
setTorch(torch: $Values<typeof TorchState>): Promise<void>;
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* Apply capture settings (resolution, focus, zoom) to the singleton camera.
|
|
499
|
+
* The provider owns the camera, so this is the only way a consumer can
|
|
500
|
+
* configure it — an AIO view has no camera of its own to settle them on.
|
|
501
|
+
*/
|
|
502
|
+
setCameraSettings(settings: CameraSettings | null): Promise<void>;
|
|
287
503
|
setPosition(position: $Values<typeof CameraPosition>): Promise<void>;
|
|
288
504
|
|
|
289
505
|
/**
|
|
@@ -316,75 +532,82 @@ declare interface CameraCoordinator {
|
|
|
316
532
|
* Resolves once the chain has applied the state this claim implies.
|
|
317
533
|
*/
|
|
318
534
|
whenGranted(claim: CameraClaim): Promise<void>;
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* Synchronous snapshot of the ownership state. Diagnostic only — never branch
|
|
538
|
+
* production code on it; the chain is the source of truth and a read here can
|
|
539
|
+
* be stale by the next microtask. Exists so the DebugApp can display
|
|
540
|
+
* ownership and Standby, which are otherwise unobservable (SDC-33115).
|
|
541
|
+
*/
|
|
542
|
+
inspect(): CameraOwnerSnapshot;
|
|
319
543
|
}
|
|
320
544
|
declare type ScanditInternal = {
|
|
321
545
|
context: DataCaptureContext,
|
|
322
546
|
owner: CameraCoordinator,
|
|
323
547
|
...
|
|
324
548
|
};
|
|
325
|
-
declare type CameraProps = {
|
|
326
|
-
frameSourceState?: $Values<typeof FrameSourceState>,
|
|
327
|
-
torchState?: $Values<typeof TorchState>,
|
|
328
|
-
cameraPosition?: $Values<typeof CameraPosition>,
|
|
329
|
-
...
|
|
330
|
-
};
|
|
331
|
-
declare type ScanditProviderProps = {
|
|
332
|
-
...CameraProps,
|
|
333
|
-
...{
|
|
334
|
-
/**
|
|
335
|
-
* Required on the root provider. Ignored (with a warning) on nested ones.
|
|
336
|
-
*/
|
|
337
|
-
licenseKey?: string,
|
|
338
|
-
|
|
339
|
-
/**
|
|
340
|
-
* Only used on the root provider.
|
|
341
|
-
*/
|
|
342
|
-
options?: DataCaptureContextCreationOptions,
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
* Only used on the root provider.
|
|
346
|
-
*/
|
|
347
|
-
settings?: DataCaptureContextSettings,
|
|
348
|
-
|
|
349
|
-
/**
|
|
350
|
-
* Called when an asynchronous camera operation rejects (e.g. a frame-source
|
|
351
|
-
* transition fails). Failures are still logged via `console.warn`; this hook
|
|
352
|
-
* lets consumers surface them (telemetry, UI). Only honored on the root
|
|
353
|
-
* provider, which owns the camera. The latest callback is always used.
|
|
354
|
-
*/
|
|
355
|
-
onError?: (error: mixed) => void,
|
|
356
|
-
children: React$1.ReactNode,
|
|
357
|
-
...
|
|
358
|
-
},
|
|
359
|
-
};
|
|
360
549
|
/**
|
|
361
|
-
*
|
|
362
|
-
*
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
550
|
+
* [object Object],[object Object],[object Object]
|
|
551
|
+
* @since 8.7.0
|
|
552
|
+
*/
|
|
553
|
+
declare interface ScanditProviderProps {
|
|
554
|
+
/**
|
|
555
|
+
* The Scandit license key. Required on the root provider; a root provider without it throws. Ignored on a nested provider.
|
|
556
|
+
* @since 8.7.0
|
|
557
|
+
*/
|
|
558
|
+
licenseKey?: string;
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* [object Object],[object Object],[object Object]
|
|
562
|
+
* @since 8.7.0
|
|
563
|
+
*/
|
|
564
|
+
options?: DataCaptureContextCreationOptions;
|
|
565
|
+
|
|
566
|
+
/**
|
|
567
|
+
* [object Object],[object Object],[object Object]
|
|
568
|
+
* @since 8.7.0
|
|
569
|
+
*/
|
|
570
|
+
settings?: DataCaptureContextSettings;
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* [object Object],[object Object],[object Object],[object Object],[object Object]
|
|
574
|
+
* @since 8.7.0
|
|
575
|
+
*/
|
|
576
|
+
frameSourceState?: $Values<typeof FrameSourceState>;
|
|
577
|
+
|
|
578
|
+
/**
|
|
579
|
+
* [object Object],[object Object],[object Object]
|
|
580
|
+
* @since 8.7.0
|
|
581
|
+
*/
|
|
582
|
+
torchState?: $Values<typeof TorchState>;
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* [object Object],[object Object],[object Object]
|
|
586
|
+
* @since 8.7.0
|
|
587
|
+
*/
|
|
588
|
+
cameraPosition?: $Values<typeof CameraPosition>;
|
|
589
|
+
|
|
590
|
+
/**
|
|
591
|
+
* [object Object],[object Object],[object Object]
|
|
592
|
+
* @since 8.7.0
|
|
593
|
+
*/
|
|
594
|
+
cameraSettings?: CameraSettings | null;
|
|
595
|
+
|
|
596
|
+
/**
|
|
597
|
+
* Called when an asynchronous camera operation fails, for example a frame source state transition. Failures are logged regardless; this exists so that they can also be surfaced in the app or sent to telemetry. Honored on the root provider only, since it owns the camera.
|
|
598
|
+
* @since 8.7.0
|
|
599
|
+
*/
|
|
600
|
+
onError?: (error: mixed) => void;
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* The React node tree that has access to this provider’s context and camera.
|
|
604
|
+
* @since 8.7.0
|
|
605
|
+
*/
|
|
606
|
+
children: React$1.ReactNode;
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
|
|
610
|
+
* @since 8.7.0
|
|
388
611
|
*/
|
|
389
612
|
declare function ScanditProvider(
|
|
390
613
|
props: ScanditProviderProps
|
|
@@ -400,6 +623,46 @@ declare function useScanditInternal(): ScanditInternal;
|
|
|
400
623
|
*/
|
|
401
624
|
declare function useDataCaptureContextInternal(): DataCaptureContext;
|
|
402
625
|
|
|
626
|
+
/**
|
|
627
|
+
* The type of the `navigation` prop on the scanning views. A view uses it to enable itself when its screen is focused and disable itself when the screen is blurred.
|
|
628
|
+
*
|
|
629
|
+
* React Navigation’s `navigation` object satisfies this interface, so it can be passed straight through. Any other source of focus events can implement the same method.
|
|
630
|
+
*
|
|
631
|
+
* ```jsx
|
|
632
|
+
* function ScanScreen({ navigation }) {
|
|
633
|
+
* return <BarcodeCaptureAioView navigation={navigation} />;
|
|
634
|
+
* }
|
|
635
|
+
* ```
|
|
636
|
+
* @since 8.7.0
|
|
637
|
+
*/
|
|
638
|
+
declare interface ScanditNavigationProp {
|
|
639
|
+
/**
|
|
640
|
+
* Subscribes to a screen event and returns the function that cancels the subscription. It is optional: a view given no `navigation` prop simply does not react to focus changes.
|
|
641
|
+
*
|
|
642
|
+
* ```jsx
|
|
643
|
+
* addListener?(type: 'focus' | 'blur', callback: () => void): () => void
|
|
644
|
+
* ```
|
|
645
|
+
* @since 8.7.0
|
|
646
|
+
*/
|
|
647
|
+
addListener?: (type: "focus" | "blur", callback: () => void) => () => void;
|
|
648
|
+
}
|
|
649
|
+
/**
|
|
650
|
+
* [object Object],[object Object],[object Object]
|
|
651
|
+
* @since 8.7.0
|
|
652
|
+
*/
|
|
653
|
+
declare interface EnableDisableHandle {
|
|
654
|
+
/**
|
|
655
|
+
* Starts scanning now: enables the mode and claims the camera. Claiming the camera supersedes whichever view held it — see Camera ownership.
|
|
656
|
+
* @since 8.7.0
|
|
657
|
+
*/
|
|
658
|
+
enable(): Promise<void>;
|
|
659
|
+
|
|
660
|
+
/**
|
|
661
|
+
* Stops scanning now: disables the mode and releases the camera.
|
|
662
|
+
* @since 8.7.0
|
|
663
|
+
*/
|
|
664
|
+
disable(): Promise<void>;
|
|
665
|
+
}
|
|
403
666
|
/**
|
|
404
667
|
* Returns a referentially-stable copy of `value` as long as the structural
|
|
405
668
|
* content stays the same. Lets consumers pass inline SDK class instances
|
|
@@ -449,7 +712,7 @@ declare function useStableProp<T>(value: T): T;
|
|
|
449
712
|
declare function usePassThroughProps<
|
|
450
713
|
Props: { [key: string]: any },
|
|
451
714
|
Target: { [key: string]: any },
|
|
452
|
-
Keys:
|
|
715
|
+
Keys: ReadonlyArray<{ ...$Keys<Props>, ...$Keys<Target> }>
|
|
453
716
|
>(
|
|
454
717
|
target: Target | null,
|
|
455
718
|
props: Props,
|
|
@@ -597,7 +860,7 @@ declare interface UseModeOptions<TMode> {
|
|
|
597
860
|
* `detach()`-ed before the consumer's `detach(mode)` is called (in reverse
|
|
598
861
|
* order). Designed for the `UseOverlayApi` returned by `useOverlay`.
|
|
599
862
|
*/
|
|
600
|
-
attachables?:
|
|
863
|
+
attachables?: ReadonlyArray<ModeAttachable>;
|
|
601
864
|
|
|
602
865
|
/**
|
|
603
866
|
* Gate attach on external readiness (e.g. native view node mounted). Defaults to true.
|
|
@@ -754,25 +1017,6 @@ declare interface UseOverlayApi<O> {
|
|
|
754
1017
|
declare function useOverlay<O: DataCaptureOverlay$1>(
|
|
755
1018
|
opts: UseOverlayOptions<O>
|
|
756
1019
|
): UseOverlayApi<O>;
|
|
757
|
-
declare interface ScanditNavigationProp {
|
|
758
|
-
/**
|
|
759
|
-
* Subscribe to a screen `focus` or `blur` event. Must return an unsubscribe
|
|
760
|
-
* function. React Navigation's `navigation` object satisfies this; any custom
|
|
761
|
-
* source can implement the same method.
|
|
762
|
-
*/
|
|
763
|
-
addListener?: (type: "focus" | "blur", callback: () => void) => () => void;
|
|
764
|
-
}
|
|
765
|
-
declare interface EnableDisableHandle {
|
|
766
|
-
/**
|
|
767
|
-
* Turn scanning on now (enable the mode, turn the camera on).
|
|
768
|
-
*/
|
|
769
|
-
enable(): Promise<void>;
|
|
770
|
-
|
|
771
|
-
/**
|
|
772
|
-
* Turn scanning off now (disable the mode, turn the camera off).
|
|
773
|
-
*/
|
|
774
|
-
disable(): Promise<void>;
|
|
775
|
-
}
|
|
776
1020
|
declare interface UseLifecycleHookProps {
|
|
777
1021
|
/**
|
|
778
1022
|
* Navigation object (e.g. React Navigation's `navigation`) for screen focus/blur.
|
|
@@ -846,6 +1090,78 @@ declare interface CameraClaimHandle {
|
|
|
846
1090
|
* and coalesces rapid changes into a single native transition.
|
|
847
1091
|
*/
|
|
848
1092
|
declare function useCameraClaim(x: UseCameraClaimOptions): CameraClaimHandle;
|
|
1093
|
+
declare interface AttachNativeViewWhenReadyOptions<T> {
|
|
1094
|
+
/**
|
|
1095
|
+
* Mode name used in the failure log, e.g. `SparkScan`. Rendered as
|
|
1096
|
+
* `[useMode:<tag>] attach failed: …` so a device log names the view that died.
|
|
1097
|
+
*/
|
|
1098
|
+
tag: string;
|
|
1099
|
+
|
|
1100
|
+
/**
|
|
1101
|
+
* The mounted native view instance, normally `viewHandle.current` captured at
|
|
1102
|
+
* render. `null` means there is nothing to attach and the attach resolves as a
|
|
1103
|
+
* no-op.
|
|
1104
|
+
*/
|
|
1105
|
+
node: T | null;
|
|
1106
|
+
|
|
1107
|
+
/**
|
|
1108
|
+
* `viewHandle.whenReady` — resolves on first layout.
|
|
1109
|
+
*/
|
|
1110
|
+
whenReady: () => Promise<void>;
|
|
1111
|
+
|
|
1112
|
+
/**
|
|
1113
|
+
* Everything this view must do once it has a native node id: build the base
|
|
1114
|
+
* view, await any camera claim, create the native view, publish state. Any
|
|
1115
|
+
* throw in here is surfaced rather than swallowed.
|
|
1116
|
+
*/
|
|
1117
|
+
createNativeView: (nodeId: number) => Promise<void>;
|
|
1118
|
+
}
|
|
1119
|
+
/**
|
|
1120
|
+
* The `attach` body shared by every AIO view that owns its own native view.
|
|
1121
|
+
*
|
|
1122
|
+
* It exists because getting this wrong is invisible. The natural shape —
|
|
1123
|
+
* `new Promise(resolve => { void whenReady().then(async () => { … resolve() }) })`
|
|
1124
|
+
* — has no rejection path, so anything thrown past `whenReady()` leaves the
|
|
1125
|
+
* returned promise neither resolved nor rejected. `useMode` serializes lifecycle
|
|
1126
|
+
* work on a single op chain, so an attach that never settles blocks *every*
|
|
1127
|
+
* later op behind it: `setEnabled` never runs, the unmount `detach()` never
|
|
1128
|
+
* runs, the camera claim never activates and the provider camera parks in
|
|
1129
|
+
* Standby. The user gets a black view with no error, no crash, and no recovery
|
|
1130
|
+
* even by navigating away and back.
|
|
1131
|
+
*
|
|
1132
|
+
* That is not hypothetical: it shipped in `SparkScanAioView`, where a colour
|
|
1133
|
+
* default typed `Color` but holding a hex string made `toJSON()` throw inside
|
|
1134
|
+
* `createNativeView` (SDC-33115). `BarcodeCountAioView` and `BarcodeArAioView`
|
|
1135
|
+
* carried the same shape with the same reachable throw sites and were working
|
|
1136
|
+
* only by luck. Routing all three through here means a fourth view cannot
|
|
1137
|
+
* reintroduce the bug by writing the obvious thing.
|
|
1138
|
+
*
|
|
1139
|
+
* Gating on layout rather than `InteractionManager.runAfterInteractions` is
|
|
1140
|
+
* deliberate: that queue can be starved by a blocked JS interaction, which
|
|
1141
|
+
* leaves the preview never created (SDC-32208).
|
|
1142
|
+
*/
|
|
1143
|
+
declare function attachNativeViewWhenReady<T>(
|
|
1144
|
+
x: AttachNativeViewWhenReadyOptions<T>
|
|
1145
|
+
): Promise<void>;
|
|
1146
|
+
|
|
1147
|
+
/**
|
|
1148
|
+
* Render an unknown thrown value as a string worth logging.
|
|
1149
|
+
*
|
|
1150
|
+
* Exists because `console.warn('...', err)` loses the only part that matters.
|
|
1151
|
+
* `Error.message` and `Error.stack` are **non-enumerable**, so any log sink that
|
|
1152
|
+
* JSON-serializes its arguments — the DebugApp's on-device console tee, among
|
|
1153
|
+
* others — writes `{}` for a plain `Error`, or, for a React Native native
|
|
1154
|
+
* rejection, just `{"code":"-1","nativeStackIOS":[…]}` with the message gone.
|
|
1155
|
+
*
|
|
1156
|
+
* That is not hypothetical. During the SDC-33115 B4 rapid-swap run the device
|
|
1157
|
+
* showed `Unable to switch the camera to on` on screen while the captured log
|
|
1158
|
+
* held only the code and a native stack, because LogBox reads `err.message`
|
|
1159
|
+
* directly and the file sink had already dropped it. Interpolating first makes
|
|
1160
|
+
* the two agree.
|
|
1161
|
+
*/
|
|
1162
|
+
declare function describeError(err: mixed): string;
|
|
1163
|
+
declare type index_d_AttachNativeViewWhenReadyOptions<T> =
|
|
1164
|
+
AttachNativeViewWhenReadyOptions<T>;
|
|
849
1165
|
declare type index_d_CameraClaimHandle = CameraClaimHandle;
|
|
850
1166
|
declare type index_d_EnableDisableHandle = EnableDisableHandle;
|
|
851
1167
|
declare type index_d_ScanditNavigationProp = ScanditNavigationProp;
|
|
@@ -860,6 +1176,8 @@ declare type index_d_UseOverlayApi<O> = UseOverlayApi<O>;
|
|
|
860
1176
|
declare type index_d_UseOverlayOptions<O: DataCaptureOverlay$1> =
|
|
861
1177
|
UseOverlayOptions<O>;
|
|
862
1178
|
declare type index_d_ViewHandle<T> = ViewHandle<T>;
|
|
1179
|
+
declare var index_d_attachNativeViewWhenReady: typeof attachNativeViewWhenReady;
|
|
1180
|
+
declare var index_d_describeError: typeof describeError;
|
|
863
1181
|
declare var index_d_useCameraClaim: typeof useCameraClaim;
|
|
864
1182
|
declare var index_d_useDataCaptureContextInternal: typeof useDataCaptureContextInternal;
|
|
865
1183
|
declare var index_d_useLifecycleHook: typeof useLifecycleHook;
|
|
@@ -872,6 +1190,8 @@ declare var index_d_useScanditInternal: typeof useScanditInternal;
|
|
|
872
1190
|
declare var index_d_useStableProp: typeof useStableProp;
|
|
873
1191
|
declare var index_d_useViewHandle: typeof useViewHandle;
|
|
874
1192
|
declare export {
|
|
1193
|
+
index_d_attachNativeViewWhenReady as attachNativeViewWhenReady,
|
|
1194
|
+
index_d_describeError as describeError,
|
|
875
1195
|
index_d_useCameraClaim as useCameraClaim,
|
|
876
1196
|
index_d_useDataCaptureContextInternal as useDataCaptureContextInternal,
|
|
877
1197
|
index_d_useLifecycleHook as useLifecycleHook,
|
|
@@ -886,6 +1206,7 @@ declare export {
|
|
|
886
1206
|
};
|
|
887
1207
|
|
|
888
1208
|
export type {
|
|
1209
|
+
index_d_AttachNativeViewWhenReadyOptions as AttachNativeViewWhenReadyOptions,
|
|
889
1210
|
index_d_CameraClaimHandle as CameraClaimHandle,
|
|
890
1211
|
index_d_EnableDisableHandle as EnableDisableHandle,
|
|
891
1212
|
index_d_ScanditNavigationProp as ScanditNavigationProp,
|
|
@@ -901,7 +1222,14 @@ declare type ScanditNativeModule = {
|
|
|
901
1222
|
[key: string]: any,
|
|
902
1223
|
} & NativeModule;
|
|
903
1224
|
declare function getNativeModule(name: string): ScanditNativeModule;
|
|
904
|
-
|
|
1225
|
+
|
|
1226
|
+
/**
|
|
1227
|
+
* Returns the dynamic residual exposed by native as `DynamicDefaults` (device id, SDK version,
|
|
1228
|
+
* probed camera positions, localized accessibility labels, ...). Every supported version of the
|
|
1229
|
+
* native side exposes it, so there is no legacy full-`Defaults`-blob fallback anymore
|
|
1230
|
+
* (SDC-32175/SDC-32178).
|
|
1231
|
+
*/
|
|
1232
|
+
declare function getModuleDynamicDefaults(name: string): any;
|
|
905
1233
|
declare class RNNativeCaller mixins NativeCaller {
|
|
906
1234
|
constructor(nativeModule: ScanditNativeModule): this;
|
|
907
1235
|
|
|
@@ -938,7 +1266,7 @@ declare export {
|
|
|
938
1266
|
ScanditProvider,
|
|
939
1267
|
index_d as _internal,
|
|
940
1268
|
createRNNativeCaller,
|
|
941
|
-
|
|
1269
|
+
getModuleDynamicDefaults,
|
|
942
1270
|
getNativeModule,
|
|
943
1271
|
initCoreDefaults,
|
|
944
1272
|
initCoreProxy,
|
|
@@ -947,8 +1275,13 @@ declare export {
|
|
|
947
1275
|
useScanditContext,
|
|
948
1276
|
};
|
|
949
1277
|
export type {
|
|
1278
|
+
CameraPermissionResult,
|
|
950
1279
|
DataCaptureViewListener,
|
|
1280
|
+
EnableDisableHandle,
|
|
1281
|
+
PermissionStatus,
|
|
951
1282
|
ScanditNativeModule,
|
|
1283
|
+
ScanditNavigationProp,
|
|
952
1284
|
ScanditProviderProps,
|
|
1285
|
+
UseScanditContextOptions,
|
|
953
1286
|
};
|
|
954
1287
|
declare export { DataCaptureView };
|