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.
@@ -1,5 +1,5 @@
1
- import { Size, Orientation, BaseDataCaptureView, MarginsWithUnit, PointWithUnit, LogoStyle, Anchor, FocusGesture, ZoomGesture, Point, Quadrilateral, Control, Serializeable, DataCaptureContext, DataCaptureContextSettings, DataCaptureContextCreationOptions, FrameSourceState, TorchState, CameraPosition, DataCaptureOverlay as DataCaptureOverlay$1, NativeCaller } from './core';
2
- export { AimerViewfinder, Anchor, Brush, Camera, CameraPosition, CameraSettings, CameraSwitchControl, ClusteringMode, Color, ContextStatus, Control, DataCaptureComponent, DataCaptureContext, DataCaptureContextCreationOptions, DataCaptureContextListener, DataCaptureContextSettings, DataCaptureMode, DataCaptureOverlay, Direction, Expiration, Feedback, FocusGesture, FocusGestureListener, FocusGestureStrategy, FocusRange, FontFamily, FrameData, FrameDataSettings, FrameDataSettingsBuilder, FrameSource, FrameSourceListener, FrameSourceState, ImageBuffer, ImageFrameSource, LaserlineViewfinder, LicenseInfo, LocationSelection, LogoStyle, MacroMode, MacroModeListener, MarginsWithUnit, MeasureUnit, NoViewfinder, NoneLocationSelection, NumberWithUnit, OpenSourceSoftwareLicenseInfo, Orientation, PinchToZoom, Point, PointWithUnit, Quadrilateral, RadiusLocationSelection, Rect, RectWithUnit, RectangularLocationSelection, RectangularViewfinder, RectangularViewfinderAnimation, RectangularViewfinderLineStyle, RectangularViewfinderStyle, ScanIntention, ScanditIcon, ScanditIconBuilder, ScanditIconShape, ScanditIconType, SelectionMode, SequenceFrameSource, Size, SizeWithAspect, SizeWithUnit, SizeWithUnitAndAspect, SizingMode, Sound, SwipeToZoom, TapToFocus, TextAlignment, TorchListener, TorchState, TorchSwitchControl, Vibration, VibrationType, VideoResolution, Viewfinder, WaveFormVibration, ZoomGesture, ZoomGestureListener, ZoomListener, ZoomSwitchControl, ZoomSwitchOrientation } from './core';
1
+ import { Size, Orientation, BaseDataCaptureView, MarginsWithUnit, PointWithUnit, LogoStyle, Anchor, FocusGesture, ZoomGesture, Point, Quadrilateral, Control, Serializeable, DataCaptureContext, DataCaptureContextSettings, DataCaptureContextCreationOptions, FrameSourceState, TorchState, CameraPosition, CameraSettings, DataCaptureOverlay as DataCaptureOverlay$1, NativeCaller } from './core';
2
+ export { AimerViewfinder, Anchor, Brush, Camera, CameraPosition, CameraSettings, CameraSwitchControl, ClusteringMode, Color, ColorFillOverlay, ContextStatus, Control, DataCaptureComponent, DataCaptureContext, DataCaptureContextCreationOptions, DataCaptureContextListener, DataCaptureContextSettings, DataCaptureMode, DataCaptureOverlay, Direction, Expiration, Feedback, FocusGesture, FocusGestureListener, FocusGestureStrategy, FocusRange, FontFamily, FrameData, FrameDataSettings, FrameDataSettingsBuilder, FrameSource, FrameSourceListener, FrameSourceState, ImageBuffer, ImageFrameSource, LaserlineViewfinder, LicenseInfo, LocationSelection, LogCategory, LogLevel, LogRecord, LogRecordError, LogoStyle, MacroMode, MacroModeListener, MarginsWithUnit, MeasureUnit, NoViewfinder, NoneLocationSelection, NumberWithUnit, OpenSourceSoftwareLicenseInfo, Orientation, PinchToZoom, Point, PointWithUnit, Quadrilateral, RadiusLocationSelection, Rect, RectWithUnit, RectangularLocationSelection, RectangularViewfinder, RectangularViewfinderAnimation, RectangularViewfinderLineStyle, RectangularViewfinderStyle, ScanIntention, ScanditIcon, ScanditIconBuilder, ScanditIconShape, ScanditIconType, ScanditLogger, SelectionMode, SequenceFrameSource, Size, SizeWithAspect, SizeWithUnit, SizeWithUnitAndAspect, SizingMode, Sound, SwipeToZoom, TapToFocus, TextAlignment, TorchListener, TorchState, TorchSwitchControl, Vibration, VibrationType, VideoResolution, Viewfinder, WaveFormVibration, ZoomGesture, ZoomGestureListener, ZoomListener, ZoomSwitchControl, ZoomSwitchOrientation } from './core';
3
3
  import React$1, { DependencyList, MutableRefObject } from 'react';
4
4
  import { StyleProp, ViewStyle, LayoutChangeEvent, NativeModule } from 'react-native';
5
5
 
@@ -7,14 +7,55 @@ declare function initCoreProxy(): void;
7
7
 
8
8
  declare function initCoreDefaults(): void;
9
9
 
10
+ /**
11
+ * This class contains the DataCapture version getter.
12
+ *
13
+ * @since 6.5.0
14
+ */
10
15
  declare class DataCaptureVersion {
16
+ /**
17
+ * Returns the version of the Scandit Data Capture Plugin.
18
+ *
19
+ * @since 6.5.0
20
+ */
11
21
  static get pluginVersion(): string;
22
+ /**
23
+ * Version of the native SDK the plugin is running against.
24
+ *
25
+ * Read from the Core defaults singleton, which `initCoreDefaults()` populates from the native
26
+ * `DynamicDefaults` payload at import time. This used to read a flat `NativeModule.Version`
27
+ * constant, which native stopped exposing when the residual moved under `DynamicDefaults`
28
+ * (SDC-32175 / SDC-32178) — so it had been returning undefined.
29
+ *
30
+ * Returns the version of the Scandit Data Capture SDK.
31
+ *
32
+ * @since 6.5.0
33
+ */
12
34
  static get sdkVersion(): string;
13
35
  }
14
36
 
37
+ /**
38
+ * A capture mode overlay is the UI counterpart of capture modes and visualizes the recognition process in the graphical user interface. Overlays highlight objects such as identified barcodes on top of the preview. Overlays may add UI elements to guide the user, such as view finders.
39
+ *
40
+ * Capture mode overlays are added to a {@link DataCaptureView} through {@link DataCaptureView.addOverlay} and removed again through {@link DataCaptureView.removeOverlay}. Overlays are associated to the data capture modes they require when they are constructed.
41
+ *
42
+ * Overlays are restricted to the set of overlays provided by the Scandit Data Capture SDK, it is not possible for customers to implement this interface and provide custom overlays. This interface does not expose any methods or properties, it just serves as a tag for different overlays.
43
+ *
44
+ * @since 6.5.0
45
+ */
15
46
  interface DataCaptureOverlay extends Serializeable {
16
47
  }
48
+ /**
49
+ * 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.
50
+ *
51
+ * @since 6.5.0
52
+ */
17
53
  interface DataCaptureViewListener {
54
+ /**
55
+ * Invoked when the data capture view changes size or orientation.
56
+ *
57
+ * @since 6.5.0
58
+ */
18
59
  didChangeSize?(view: DataCaptureView, size: Size, orientation: Orientation): void;
19
60
  }
20
61
  interface DataCaptureViewProps {
@@ -30,41 +71,189 @@ interface DataCaptureViewProps {
30
71
  */
31
72
  onNativeDispose?: (teardown: Promise<unknown>) => void;
32
73
  }
74
+ /**
75
+ * A React Native component that is the main UI view to be used together with the data capture context for applications that wish to display a video preview together with additional augmentations such as barcode locations.
76
+ *
77
+ * This class should generally not be subclassed, instead you can wrap it in another React Native component if necessary.
78
+ *
79
+ * The data capture view itself only displays the preview and shows UI elements to control the camera, such as buttons to switch torch on and off, or a button to switch between front and back facing cameras. Augmentations, such as the locations of identified barcodes are provided by individual overlays. This view will also display errors in case something goes wrong with its context, see the {@link ContextStatus} for a list of possible errors.
80
+ *
81
+ * Unless otherwise specified, methods and properties of this class should only be accessed from the main thread.
82
+ *
83
+ * DataCaptureView class component example:
84
+ *
85
+ * ```jsx
86
+ * class DataCaptureViewComponent extends React.Component {
87
+ * state = { context: DataCaptureContext.forLicenseKey('-- ENTER YOUR SCANDIT LICENSE KEY HERE --') }
88
+ *
89
+ * ...
90
+ *
91
+ * render() {
92
+ * return (
93
+ * <DataCaptureView style={{ flex: 1 }} context={this.state.context}/>
94
+ * );
95
+ * }
96
+ * }
97
+ * ```
98
+ *
99
+ * **Related topics**: [Get Started](https://docs.scandit.com/sdks/react-native/barcode-capture/get-started), [MatrixScan Get Started](https://docs.scandit.com/sdks/react-native/matrixscan/get-started), Core Concepts <https://docs.scandit.com/core-concepts>.
100
+ *
101
+ * @since 6.5.0
102
+ */
33
103
  declare class DataCaptureView extends React$1.Component<DataCaptureViewProps> {
34
104
  protected view: BaseDataCaptureView;
35
105
  private _isMounted;
36
106
  private _viewCreated;
37
107
  private _createViewRafHandle;
38
108
  constructor(props: DataCaptureViewProps);
109
+ /**
110
+ * 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.
111
+ *
112
+ * By default, the margins are zero and the scanning happens in the visible part of the preview.
113
+ *
114
+ * 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.
115
+ *
116
+ * @since 6.5.0
117
+ */
39
118
  get scanAreaMargins(): MarginsWithUnit;
40
119
  set scanAreaMargins(newValue: MarginsWithUnit);
120
+ /**
121
+ * The point of interest of this data capture view. By default, the point of interest is centered in the data capture view. The point of interest is used to control the *center of attention* for the following subsystems:
122
+ *
123
+ * - Auto focus and exposure metering of the camera.
124
+ * - {@link LocationSelection|Location selections} for capture modes that support them. When no location selection is set, the point of interest defines the location at which the recognition optimizes for reading codes/text/etc.
125
+ * - Rendered {@link Viewfinder|viewfinders}.
126
+ *
127
+ * The point of interest can be overwritten by individual capture modes such as {@link BarcodeCapture}. The overwriting point of interest only affects the center of the location selection and viewfinder of said mode, it does not affect the auto focus or exposure metering of the camera.
128
+ *
129
+ * @since 6.5.0
130
+ */
41
131
  get pointOfInterest(): PointWithUnit;
42
132
  set pointOfInterest(newValue: PointWithUnit);
133
+ /**
134
+ * The style of the logo which can be either the default extended “Scanning By Scandit” or a minimal “Scandit”.
135
+ *
136
+ * This property has no effect when the logo is drawn by one of the viewfinders.
137
+ *
138
+ * @since 6.8.0
139
+ */
43
140
  get logoStyle(): LogoStyle;
44
141
  set logoStyle(style: LogoStyle);
142
+ /**
143
+ * The anchor point to use for positioning the “Scanning By Scandit” logo. By default the logo is placed in the lower-right corner of the scan area ({@link Anchor.BottomRight}).
144
+ *
145
+ * To shift the logo relative to the anchor position, use the {@link DataCaptureView.logoOffset} property.
146
+ *
147
+ * This property has no effect when the logo is drawn by one of the viewfinders.
148
+ *
149
+ * @since 6.5.0
150
+ */
45
151
  get logoAnchor(): Anchor;
46
152
  set logoAnchor(newValue: Anchor);
153
+ /**
154
+ * The offset applied to the “Scanning By Scandit” logo relative to the {@link DataCaptureView.logoAnchor|logo anchor}. When specified in pixels ({@link MeasureUnit.Pixel}) or device-independent pixels ({@link MeasureUnit.DIP}), the offset is used as-is. When specified as a fraction ({@link MeasureUnit.Fraction}), the offset is computed relative to the view size minus the scan area margins. For example, a value of 0.1 for the x-coordinate will set the offset to be 10% of the view width minus the left and right margins.
155
+ *
156
+ * This property has no effect when the logo is drawn by one of the viewfinders.
157
+ *
158
+ * @since 6.5.0
159
+ */
47
160
  get logoOffset(): PointWithUnit;
48
161
  set logoOffset(newValue: PointWithUnit);
162
+ /**
163
+ * The gesture used to focus. Defaults to {@link TapToFocus}. Set to *null* if no focus gesture is desired.
164
+ *
165
+ * @since 6.7.0
166
+ */
49
167
  get focusGesture(): FocusGesture | null;
50
168
  set focusGesture(newValue: FocusGesture | null);
169
+ /**
170
+ * The gestures used to zoom. Defaults to [{@link SwipeToZoom}, {@link PinchToZoom}]. Set to empty array if no zoom gesture is desired.
171
+ *
172
+ * @since 8.4.0
173
+ */
51
174
  get zoomGestures(): ZoomGesture[];
52
175
  set zoomGestures(newValue: ZoomGesture[]);
53
- /** @deprecated Use zoomGestures instead. Will be removed in a future version. */
176
+ /**
177
+ * The gesture used to zoom. Defaults to {@link SwipeToZoom}. Set to *null* if no zoom gesture is desired.
178
+ *
179
+ * @since 6.7.0
180
+ * @deprecated Use zoomGestures instead. Will be removed in a future version.
181
+ */
54
182
  get zoomGesture(): ZoomGesture | null;
55
183
  /** @deprecated Use zoomGestures instead. Will be removed in a future version. */
56
184
  set zoomGesture(newValue: ZoomGesture | null);
185
+ /**
186
+ * When enabled, the data capture view may display notifications to inform users about update in zoom level. Defaults to *true*.
187
+ *
188
+ * @since 8.3.0
189
+ */
57
190
  get shouldShowZoomNotification(): boolean;
58
191
  set shouldShowZoomNotification(newValue: boolean);
192
+ /**
193
+ * 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.
194
+ *
195
+ * @since 8.3.0
196
+ */
59
197
  setProperty<T>(name: string, value: T): void;
198
+ /**
199
+ * Adds the overlay to this data capture view. If the overlay is already part of this view, the call has no effect.
200
+ *
201
+ * @since 6.5.0
202
+ */
60
203
  addOverlay(overlay: DataCaptureOverlay): Promise<void>;
204
+ /**
205
+ * Removes overlay from this data capture view. If the overlay is not part of this view, the call has no effect.
206
+ *
207
+ * @since 6.5.0
208
+ */
61
209
  removeOverlay(overlay: DataCaptureOverlay): Promise<void>;
210
+ /**
211
+ * Adds the listener to this data capture view.
212
+ *
213
+ * In case the same listener is already observing this instance, calling this method will not add the listener again.
214
+ *
215
+ * @since 6.5.0
216
+ */
62
217
  addListener(listener: DataCaptureViewListener): void;
218
+ /**
219
+ * Removes a previously added listener from this data capture view.
220
+ *
221
+ * In case the listener is not currently observing this instance, calling this method has no effect.
222
+ *
223
+ * @since 6.5.0
224
+ */
63
225
  removeListener(listener: DataCaptureViewListener): void;
226
+ /**
227
+ * Converts a point in the coordinate system of the last visible frame and maps it to a coordinate in the view.
228
+ *
229
+ * This method is thread-safe and can be called from any thread.
230
+ *
231
+ * @since 6.5.0
232
+ */
64
233
  viewPointForFramePoint(point: Point): Promise<Point>;
234
+ /**
235
+ * Converts a quadrilateral in the coordinate system of the last visible frame and maps it to a coordinate in the view.
236
+ *
237
+ * @since 6.5.0
238
+ */
65
239
  viewQuadrilateralForFrameQuadrilateral(quadrilateral: Quadrilateral): Promise<Quadrilateral>;
240
+ /**
241
+ * Adds the control to the data capture view. In case multiple controls get added, the order in which {@link DataCaptureView.addControl} gets called determines how the controls are going to be laid out. If the control is already part of this view, the call has no effect.
242
+ *
243
+ * @since 6.8.0
244
+ */
66
245
  addControl(control: Control): Promise<void>;
246
+ /**
247
+ * 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.
248
+ *
249
+ * @since 6.22.0
250
+ */
67
251
  addControlWithAnchorAndOffset(control: Control, anchor: Anchor, offset: PointWithUnit): void;
252
+ /**
253
+ * Removes the previously added control from data capture view. If the control is not part of this view, the call has no effect.
254
+ *
255
+ * @since 6.8.0
256
+ */
68
257
  removeControl(control: Control): void;
69
258
  componentWillUnmount(): void;
70
259
  componentDidMount(): void;
@@ -82,15 +271,37 @@ declare class DataCaptureView extends React$1.Component<DataCaptureViewProps> {
82
271
  * ```tsx
83
272
  * const isForeground = useIsForeground();
84
273
  * const isFocused = useIsFocused(); // from @react-navigation/native
85
- * <BarcodeCaptureView isActive={isFocused && isForeground} ... />
274
+ * <BarcodeCaptureAioView isActive={isFocused && isForeground} ... />
86
275
  * ```
87
276
  */
88
277
  declare function useIsForeground(): boolean;
89
278
 
90
279
  type PermissionStatus = 'granted' | 'denied' | 'not-determined' | 'restricted';
280
+ /**
281
+ * The value returned by {@link core.UseCameraPermission}.
282
+ *
283
+ * @since 8.7.0
284
+ */
91
285
  interface CameraPermissionResult {
286
+ /**
287
+ * Whether camera access is currently granted. True exactly when {@link CameraPermissionResult.permissionStatus} is `granted`.
288
+ *
289
+ * @since 8.7.0
290
+ */
92
291
  hasPermission: boolean;
292
+ /**
293
+ * The current permission status, typed as `PermissionStatus` — a union of four string values:
294
+ *
295
+ * `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`.
296
+ *
297
+ * @since 8.7.0
298
+ */
93
299
  permissionStatus: PermissionStatus;
300
+ /**
301
+ * Requests camera access and resolves to whether it was granted. On Android this shows the system prompt. On iOS it cannot drive the prompt and resolves to `true` optimistically — see {@link core.UseCameraPermission}.
302
+ *
303
+ * @since 8.7.0
304
+ */
94
305
  requestPermission: () => Promise<boolean>;
95
306
  }
96
307
  /**
@@ -106,7 +317,7 @@ interface CameraPermissionResult {
106
317
  * On iOS this hook returns `permissionStatus: 'not-determined'` initially and
107
318
  * optimistically flips to `'granted'` after `requestPermission()` is called.
108
319
  * It cannot detect denials after-the-fact; consumers should treat the iOS camera-start
109
- * flow as the authoritative signal (surfaced via `<BarcodeCaptureView onError={...} />`).
320
+ * flow as the authoritative signal (surfaced via `<BarcodeCaptureAioView onError={...} />`).
110
321
  *
111
322
  * ```tsx
112
323
  * const { hasPermission, requestPermission } = useCameraPermission();
@@ -115,14 +326,23 @@ interface CameraPermissionResult {
115
326
  */
116
327
  declare function useCameraPermission(): CameraPermissionResult;
117
328
 
329
+ /**
330
+ * The options accepted by {@link core.UseScanditContext}.
331
+ *
332
+ * @since 8.7.0
333
+ */
118
334
  interface UseScanditContextOptions {
119
335
  /**
120
- * Applied at first render, then re-applied via `context.applySettings(...)`
121
- * whenever the reference changes. Memoize this with `useMemo` (or build it
122
- * once) — passing a fresh instance every render will spam `applySettings`.
336
+ * Applied on the first call, then re-applied through {@link DataCaptureContext.applySettings} whenever a different instance is passed. Build the instance once, or memoize it — passing a new instance on every render re-applies the settings on every render.
337
+ *
338
+ * @since 8.7.0
123
339
  */
124
340
  settings?: DataCaptureContextSettings;
125
- /** Applied once at native initialization. Later changes are ignored. */
341
+ /**
342
+ * Applied once, when the context is created natively. Later changes are ignored.
343
+ *
344
+ * @since 8.7.0
345
+ */
126
346
  creationOptions?: DataCaptureContextCreationOptions;
127
347
  }
128
348
  /**
@@ -144,12 +364,39 @@ interface CameraClaim {
144
364
  mode: CameraClaimMode;
145
365
  active: boolean;
146
366
  }
367
+ /** What the provider last applied to its own camera (native state latch). */
368
+ type CameraAppliedState = 'on' | 'standby' | 'off';
369
+ /**
370
+ * Read-only snapshot of the ownership state, for diagnostics only.
371
+ *
372
+ * The engine's invariants ("one screen holds the claim", "the camera drops to
373
+ * Standby between screens") are otherwise invisible at runtime: ownership lives
374
+ * in a closure variable and Standby is a native state with no queryable
375
+ * counterpart on the JS side. Without this, verifying them on-device means
376
+ * inferring from the *absence* of a log line (SDC-33115).
377
+ */
378
+ interface CameraOwnerSnapshot {
379
+ /** The current owner's claim mode, or null when no screen holds the claim. */
380
+ ownerMode: CameraClaimMode | null;
381
+ /** The last state the provider applied to its own camera. */
382
+ applied: CameraAppliedState;
383
+ /** True only after a fully successful acquire (both native calls confirmed). */
384
+ acquireSucceeded: boolean;
385
+ /** Number of mutation steps not yet drained by an apply pass. */
386
+ pendingSteps: number;
387
+ }
147
388
  /**
148
389
  * The ownership surface `useCameraClaim` is built on, plus camera-wide
149
390
  * controls (torch/position) and lifecycle.
150
391
  */
151
392
  interface CameraCoordinator {
152
393
  setTorch(torch: TorchState): Promise<void>;
394
+ /**
395
+ * Apply capture settings (resolution, focus, zoom) to the singleton camera.
396
+ * The provider owns the camera, so this is the only way a consumer can
397
+ * configure it — an AIO view has no camera of its own to settle them on.
398
+ */
399
+ setCameraSettings(settings: CameraSettings | null): Promise<void>;
153
400
  setPosition(position: CameraPosition): Promise<void>;
154
401
  /**
155
402
  * Resolves when the current op chain has drained (errors swallowed).
@@ -173,39 +420,88 @@ interface CameraCoordinator {
173
420
  removeClaim(claim: CameraClaim, teardown?: Promise<unknown>): void;
174
421
  /** Resolves once the chain has applied the state this claim implies. */
175
422
  whenGranted(claim: CameraClaim): Promise<void>;
423
+ /**
424
+ * Synchronous snapshot of the ownership state. Diagnostic only — never branch
425
+ * production code on it; the chain is the source of truth and a read here can
426
+ * be stale by the next microtask. Exists so the DebugApp can display
427
+ * ownership and Standby, which are otherwise unobservable (SDC-33115).
428
+ */
429
+ inspect(): CameraOwnerSnapshot;
176
430
  }
177
431
  type ScanditInternal = {
178
432
  context: DataCaptureContext;
179
433
  owner: CameraCoordinator;
180
434
  };
181
- type CameraProps = {
182
- frameSourceState?: FrameSourceState;
183
- torchState?: TorchState;
184
- cameraPosition?: CameraPosition;
185
- };
186
- type ScanditProviderProps = CameraProps & {
187
- /** Required on the root provider. Ignored (with a warning) on nested ones. */
435
+ /**
436
+ * The props of {@link ScanditProvider}.
437
+ *
438
+ * @since 8.7.0
439
+ */
440
+ interface ScanditProviderProps {
441
+ /**
442
+ * The Scandit license key. Required on the root provider; a root provider without it throws. Ignored on a nested provider.
443
+ *
444
+ * @since 8.7.0
445
+ */
188
446
  licenseKey?: string;
189
- /** Only used on the root provider. */
447
+ /**
448
+ * Options applied when the {@link DataCaptureContext} is created. Used by the root provider only, and only at creation — later changes have no effect.
449
+ *
450
+ * @since 8.7.0
451
+ */
190
452
  options?: DataCaptureContextCreationOptions;
191
- /** Only used on the root provider. */
453
+ /**
454
+ * Settings applied to the {@link DataCaptureContext}. Used by the root provider only.
455
+ *
456
+ * @since 8.7.0
457
+ */
192
458
  settings?: DataCaptureContextSettings;
193
459
  /**
194
- * Called when an asynchronous camera operation rejects (e.g. a frame-source
195
- * transition fails). Failures are still logged via `console.warn`; this hook
196
- * lets consumers surface them (telemetry, UI). Only honored on the root
197
- * provider, which owns the camera. The latest callback is always used.
460
+ * Claims the camera for as long as this is {@link FrameSourceState.On}, without a scanning view being present. Any other value, including leaving it unset, means the provider does not claim the camera and the views below it drive it instead. A view that becomes active while this is {@link FrameSourceState.On} supersedes the provider’s claim.
461
+ *
462
+ * @since 8.7.0
463
+ */
464
+ frameSourceState?: FrameSourceState;
465
+ /**
466
+ * The torch state of the shared camera. On the root provider, leaving it unset applies {@link TorchState.Off}. On a nested provider it is set-only: leaving it unset leaves the torch as the last writer left it. Does not reach `SparkScanAioView` — see Configuring the camera.
467
+ *
468
+ * @since 8.7.0
469
+ */
470
+ torchState?: TorchState;
471
+ /**
472
+ * The position of the shared camera. On the root provider, leaving it unset applies {@link CameraPosition.WorldFacing}. On a nested provider it is set-only: leaving it unset leaves the position as the last writer left it. Changing it recreates the camera. Does not reach `SparkScanAioView` — see Configuring the camera.
473
+ *
474
+ * @since 8.7.0
475
+ */
476
+ cameraPosition?: CameraPosition;
477
+ /**
478
+ * Capture settings — see {@link CameraSettings} — for the shared camera. The provider owns the camera, so this is the only way to configure it: a scanning view has no camera of its own to apply them to.
479
+ *
480
+ * Compared structurally, so an inline `new CameraSettings()` does not need `useMemo`. Set-only on the root provider as well as on nested ones — no default is applied, so leaving it unset or passing `null` leaves the camera as it is rather than restoring device defaults, and a value set by a nested provider outlives that provider’s unmount.
481
+ *
482
+ * @since 8.7.0
483
+ */
484
+ cameraSettings?: CameraSettings | null;
485
+ /**
486
+ * 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.
487
+ *
488
+ * @since 8.7.0
198
489
  */
199
490
  onError?: (error: unknown) => void;
491
+ /**
492
+ * The React node tree that has access to this provider’s context and camera.
493
+ *
494
+ * @since 8.7.0
495
+ */
200
496
  children: React$1.ReactNode;
201
- };
497
+ }
202
498
  /**
203
499
  * Provides a `DataCaptureContext` and a singleton `Camera` to descendant AIO views.
204
500
  *
205
501
  * - **Root** (no parent `<ScanditProvider>` above): creates the context + camera,
206
502
  * disposes them on unmount.
207
503
  * - **Nested**: applies its own `frameSourceState` / `torchState` / `cameraPosition`
208
- * props to the same singleton camera. Last writer wins; values are not reverted
504
+ * / `cameraSettings` props to the same singleton camera. Last writer wins; values are not reverted
209
505
  * when a nested provider unmounts.
210
506
  *
211
507
  * The camera is ownership-driven: exactly one view owns it at a time (last
@@ -224,9 +520,13 @@ type ScanditProviderProps = CameraProps & {
224
520
  * frameSourceState={isFocused ? FrameSourceState.On : FrameSourceState.Off}
225
521
  * torchState={torch}
226
522
  * cameraPosition={position}>
227
- * <BarcodeCaptureView state="enabled" ... />
523
+ * <BarcodeCaptureAioView navigation={navigation} ... />
228
524
  * </ScanditProvider>
229
525
  * ```
526
+ *
527
+ * A React component that provides a {@link DataCaptureContext} and a shared {@link Camera} to the scanning views below it. Takes {@link ScanditProviderProps}. See Camera ownership for how the shared camera moves between views.
528
+ *
529
+ * @since 8.7.0
230
530
  */
231
531
  declare function ScanditProvider(props: ScanditProviderProps): React$1.JSX.Element;
232
532
  /** Internal — exposes the shared context + camera coordinator to AIO views. */
@@ -234,6 +534,65 @@ declare function useScanditInternal(): ScanditInternal;
234
534
  /** Internal — used by AIO views to attach modes to the shared context. */
235
535
  declare function useDataCaptureContextInternal(): DataCaptureContext;
236
536
 
537
+ /**
538
+ * 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.
539
+ *
540
+ * 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.
541
+ *
542
+ * ```jsx
543
+ * function ScanScreen({ navigation }) {
544
+ * return <BarcodeCaptureAioView navigation={navigation} />;
545
+ * }
546
+ * ```
547
+ *
548
+ * @since 8.7.0
549
+ */
550
+ interface ScanditNavigationProp {
551
+ /**
552
+ * 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.
553
+ *
554
+ * ```jsx
555
+ * addListener?(type: 'focus' | 'blur', callback: () => void): () => void
556
+ * ```
557
+ *
558
+ * @since 8.7.0
559
+ */
560
+ addListener?(type: 'focus' | 'blur', callback: () => void): () => void;
561
+ }
562
+ /**
563
+ * Imperative control over whether a scanning view is scanning. Every scanning view’s `ref` handle carries these two methods, so they are available on any of them.
564
+ *
565
+ * Reach for this only when the declarative path does not fit. Normally a view is driven by its {@link ScanditNavigationProp} and its `disabled` prop, which handle screen focus and app background automatically — see Camera ownership.
566
+ *
567
+ * ```jsx
568
+ * const ref = useRef(null);
569
+ *
570
+ * <BarcodeCaptureAioView ref={ref} navigation={navigation} />
571
+ * <Button title="Pause" onPress={() => ref.current?.disable()} />
572
+ * ```
573
+ *
574
+ * @since 8.7.0
575
+ */
576
+ interface EnableDisableHandle {
577
+ /**
578
+ * Starts scanning now: enables the mode and claims the camera. Claiming the camera supersedes whichever view held it — see Camera ownership.
579
+ *
580
+ * @since 8.7.0
581
+ */
582
+ enable(): Promise<void>;
583
+ /**
584
+ * Stops scanning now: disables the mode and releases the camera.
585
+ *
586
+ * @since 8.7.0
587
+ */
588
+ disable(): Promise<void>;
589
+ }
590
+
591
+
592
+
593
+
594
+
595
+
237
596
 
238
597
 
239
598
  /**
@@ -526,20 +885,10 @@ interface UseOverlayApi<O> {
526
885
  */
527
886
  declare function useOverlay<O extends DataCaptureOverlay$1>(opts: UseOverlayOptions<O>): UseOverlayApi<O>;
528
887
 
529
- interface ScanditNavigationProp {
530
- /**
531
- * Subscribe to a screen `focus` or `blur` event. Must return an unsubscribe
532
- * function. React Navigation's `navigation` object satisfies this; any custom
533
- * source can implement the same method.
534
- */
535
- addListener?(type: 'focus' | 'blur', callback: () => void): () => void;
536
- }
537
- interface EnableDisableHandle {
538
- /** Turn scanning on now (enable the mode, turn the camera on). */
539
- enable(): Promise<void>;
540
- /** Turn scanning off now (disable the mode, turn the camera off). */
541
- disable(): Promise<void>;
542
- }
888
+
889
+
890
+
891
+
543
892
  interface UseLifecycleHookProps {
544
893
  /** Navigation object (e.g. React Navigation's `navigation`) for screen focus/blur. */
545
894
  navigation?: ScanditNavigationProp;
@@ -602,6 +951,70 @@ interface CameraClaimHandle {
602
951
  */
603
952
  declare function useCameraClaim({ mode, active, nativeViewRef }: UseCameraClaimOptions): CameraClaimHandle;
604
953
 
954
+ interface AttachNativeViewWhenReadyOptions<T> {
955
+ /**
956
+ * Mode name used in the failure log, e.g. `SparkScan`. Rendered as
957
+ * `[useMode:<tag>] attach failed: …` so a device log names the view that died.
958
+ */
959
+ tag: string;
960
+ /**
961
+ * The mounted native view instance, normally `viewHandle.current` captured at
962
+ * render. `null` means there is nothing to attach and the attach resolves as a
963
+ * no-op.
964
+ */
965
+ node: T | null;
966
+ /** `viewHandle.whenReady` — resolves on first layout. */
967
+ whenReady: () => Promise<void>;
968
+ /**
969
+ * Everything this view must do once it has a native node id: build the base
970
+ * view, await any camera claim, create the native view, publish state. Any
971
+ * throw in here is surfaced rather than swallowed.
972
+ */
973
+ createNativeView: (nodeId: number) => Promise<void>;
974
+ }
975
+ /**
976
+ * The `attach` body shared by every AIO view that owns its own native view.
977
+ *
978
+ * It exists because getting this wrong is invisible. The natural shape —
979
+ * `new Promise(resolve => { void whenReady().then(async () => { … resolve() }) })`
980
+ * — has no rejection path, so anything thrown past `whenReady()` leaves the
981
+ * returned promise neither resolved nor rejected. `useMode` serializes lifecycle
982
+ * work on a single op chain, so an attach that never settles blocks *every*
983
+ * later op behind it: `setEnabled` never runs, the unmount `detach()` never
984
+ * runs, the camera claim never activates and the provider camera parks in
985
+ * Standby. The user gets a black view with no error, no crash, and no recovery
986
+ * even by navigating away and back.
987
+ *
988
+ * That is not hypothetical: it shipped in `SparkScanAioView`, where a colour
989
+ * default typed `Color` but holding a hex string made `toJSON()` throw inside
990
+ * `createNativeView` (SDC-33115). `BarcodeCountAioView` and `BarcodeArAioView`
991
+ * carried the same shape with the same reachable throw sites and were working
992
+ * only by luck. Routing all three through here means a fourth view cannot
993
+ * reintroduce the bug by writing the obvious thing.
994
+ *
995
+ * Gating on layout rather than `InteractionManager.runAfterInteractions` is
996
+ * deliberate: that queue can be starved by a blocked JS interaction, which
997
+ * leaves the preview never created (SDC-32208).
998
+ */
999
+ declare function attachNativeViewWhenReady<T>({ tag, node, whenReady, createNativeView, }: AttachNativeViewWhenReadyOptions<T>): Promise<void>;
1000
+
1001
+ /**
1002
+ * Render an unknown thrown value as a string worth logging.
1003
+ *
1004
+ * Exists because `console.warn('...', err)` loses the only part that matters.
1005
+ * `Error.message` and `Error.stack` are **non-enumerable**, so any log sink that
1006
+ * JSON-serializes its arguments — the DebugApp's on-device console tee, among
1007
+ * others — writes `{}` for a plain `Error`, or, for a React Native native
1008
+ * rejection, just `{"code":"-1","nativeStackIOS":[…]}` with the message gone.
1009
+ *
1010
+ * That is not hypothetical. During the SDC-33115 B4 rapid-swap run the device
1011
+ * showed `Unable to switch the camera to on` on screen while the captured log
1012
+ * held only the code and a native stack, because LogBox reads `err.message`
1013
+ * directly and the file sink had already dropped it. Interpolating first makes
1014
+ * the two agree.
1015
+ */
1016
+ declare function describeError(err: unknown): string;
1017
+
605
1018
 
606
1019
 
607
1020
 
@@ -613,6 +1026,8 @@ declare function useCameraClaim({ mode, active, nativeViewRef }: UseCameraClaimO
613
1026
 
614
1027
 
615
1028
 
1029
+
1030
+ type index_d_AttachNativeViewWhenReadyOptions<T> = AttachNativeViewWhenReadyOptions<T>;
616
1031
  type index_d_CameraClaimHandle = CameraClaimHandle;
617
1032
  type index_d_EnableDisableHandle = EnableDisableHandle;
618
1033
  type index_d_ScanditNavigationProp = ScanditNavigationProp;
@@ -623,6 +1038,8 @@ type index_d_UseModeOptions<TMode> = UseModeOptions<TMode>;
623
1038
  type index_d_UseOverlayApi<O> = UseOverlayApi<O>;
624
1039
  type index_d_UseOverlayOptions<O extends DataCaptureOverlay$1> = UseOverlayOptions<O>;
625
1040
  type index_d_ViewHandle<T> = ViewHandle<T>;
1041
+ declare const index_d_attachNativeViewWhenReady: typeof attachNativeViewWhenReady;
1042
+ declare const index_d_describeError: typeof describeError;
626
1043
  declare const index_d_useCameraClaim: typeof useCameraClaim;
627
1044
  declare const index_d_useDataCaptureContextInternal: typeof useDataCaptureContextInternal;
628
1045
  declare const index_d_useLifecycleHook: typeof useLifecycleHook;
@@ -635,15 +1052,21 @@ declare const index_d_useScanditInternal: typeof useScanditInternal;
635
1052
  declare const index_d_useStableProp: typeof useStableProp;
636
1053
  declare const index_d_useViewHandle: typeof useViewHandle;
637
1054
  declare namespace index_d {
638
- export { index_d_useCameraClaim as useCameraClaim, index_d_useDataCaptureContextInternal as useDataCaptureContextInternal, index_d_useLifecycleHook as useLifecycleHook, index_d_useMode as useMode, index_d_useModeListener as useModeListener, index_d_useNativeControl as useNativeControl, index_d_useOverlay as useOverlay, index_d_usePassThroughProps as usePassThroughProps, index_d_useScanditInternal as useScanditInternal, index_d_useStableProp as useStableProp, index_d_useViewHandle as useViewHandle };
639
- export type { index_d_CameraClaimHandle as CameraClaimHandle, index_d_EnableDisableHandle as EnableDisableHandle, index_d_ScanditNavigationProp as ScanditNavigationProp, index_d_UseCameraClaimOptions as UseCameraClaimOptions, index_d_UseModeApi as UseModeApi, index_d_UseModeListenerProps as UseModeListenerProps, index_d_UseModeOptions as UseModeOptions, index_d_UseOverlayApi as UseOverlayApi, index_d_UseOverlayOptions as UseOverlayOptions, index_d_ViewHandle as ViewHandle };
1055
+ export { index_d_attachNativeViewWhenReady as attachNativeViewWhenReady, index_d_describeError as describeError, index_d_useCameraClaim as useCameraClaim, index_d_useDataCaptureContextInternal as useDataCaptureContextInternal, index_d_useLifecycleHook as useLifecycleHook, index_d_useMode as useMode, index_d_useModeListener as useModeListener, index_d_useNativeControl as useNativeControl, index_d_useOverlay as useOverlay, index_d_usePassThroughProps as usePassThroughProps, index_d_useScanditInternal as useScanditInternal, index_d_useStableProp as useStableProp, index_d_useViewHandle as useViewHandle };
1056
+ export type { index_d_AttachNativeViewWhenReadyOptions as AttachNativeViewWhenReadyOptions, index_d_CameraClaimHandle as CameraClaimHandle, index_d_EnableDisableHandle as EnableDisableHandle, index_d_ScanditNavigationProp as ScanditNavigationProp, index_d_UseCameraClaimOptions as UseCameraClaimOptions, index_d_UseModeApi as UseModeApi, index_d_UseModeListenerProps as UseModeListenerProps, index_d_UseModeOptions as UseModeOptions, index_d_UseOverlayApi as UseOverlayApi, index_d_UseOverlayOptions as UseOverlayOptions, index_d_ViewHandle as ViewHandle };
640
1057
  }
641
1058
 
642
1059
  interface ScanditNativeModule extends NativeModule {
643
1060
  [key: string]: any;
644
1061
  }
645
1062
  declare function getNativeModule(name: string): ScanditNativeModule;
646
- declare function getModuleDefaults(name: string): any;
1063
+ /**
1064
+ * Returns the dynamic residual exposed by native as `DynamicDefaults` (device id, SDK version,
1065
+ * probed camera positions, localized accessibility labels, ...). Every supported version of the
1066
+ * native side exposes it, so there is no legacy full-`Defaults`-blob fallback anymore
1067
+ * (SDC-32175/SDC-32178).
1068
+ */
1069
+ declare function getModuleDynamicDefaults(name: string): any;
647
1070
 
648
1071
  declare class RNNativeCaller implements NativeCaller {
649
1072
  private nativeModule;
@@ -667,6 +1090,6 @@ declare class RNNativeCaller implements NativeCaller {
667
1090
  }
668
1091
  declare function createRNNativeCaller(nativeModule: ScanditNativeModule): RNNativeCaller;
669
1092
 
670
- export { DataCaptureVersion, RNNativeCaller, ScanditProvider, index_d as _internal, createRNNativeCaller, getModuleDefaults, getNativeModule, initCoreDefaults, initCoreProxy, useCameraPermission, useIsForeground, useScanditContext };
671
- export type { DataCaptureViewListener, ScanditNativeModule, ScanditProviderProps };
1093
+ export { DataCaptureVersion, RNNativeCaller, ScanditProvider, index_d as _internal, createRNNativeCaller, getModuleDynamicDefaults, getNativeModule, initCoreDefaults, initCoreProxy, useCameraPermission, useIsForeground, useScanditContext };
1094
+ export type { CameraPermissionResult, DataCaptureViewListener, EnableDisableHandle, PermissionStatus, ScanditNativeModule, ScanditNavigationProp, ScanditProviderProps, UseScanditContextOptions };
672
1095
  export { DataCaptureView };