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