React Native
Props
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
ref | React.Ref<VisionSdkRefProps> | — | No | Imperative ref to call methods (capture, start/stop, etc.) on the camera. |
apiKey | string | '' | No | API key for Vision SDK authentication. |
token | string | '' | No | Auth token for Vision SDK authentication. |
locationId | string | '' | No | Identifier for a specific location override. |
options | Record<string, any> | {} | No | Additional configuration options to pass to the native view. |
environment | 'dev' | 'qa' | 'staging' | 'prod' | 'sandbox' | 'prod' | No | Backend environment to use (prod, sandbox, etc.). |
captureMode | 'manual' | 'auto' | 'manual' | No | Whether captures are triggered manually or automatically. |
mode | 'barcode' | 'qrcode' | 'ocr' | 'photo' | 'barCodeOrQRCode' | 'priceTag' | 'barcode' | No | Scanning mode for barcodes, QR codes, OCR, photo-only, or mixed barCodeOrQRCode. |
ocrMode | 'cloud' | 'on-device' | 'on-device-with-translation' | 'bill-of-lading' | 'item_label' | 'document_classification' | 'cloud' | No | OCR processing mode (cloud vs. various on‑device options). |
ocrType | 'shipping_label' | 'bill_of_lading' | 'item_label' | 'document_classification' | … | 'shipping_label' | No | Specific OCR use‑case/type (e.g. shipping_label, item_label, document_classification, etc.). |
shouldResizeImage | boolean | true | No | Whether to resize images before sending to the SDK/API. |
isMultipleScanEnabled | boolean | false | No | Enable or disable multiple‑scan mode in one session. |
flash | boolean | false | No | Turn camera flash on or off. |
isEnableAutoOcrResponseWithImage | boolean | true | No | Automatically include the captured image in the OCR response. |
modelExecutionProviderAndroid | 'NNAPI' | 'CPU' | 'XNNPACK' | 'CPU' | No | Configure OCR model execution provider for Android (NNAPI, CPU, or XNNPACK). |
zoomLevel | number | 1.8 | No | Zoom factor for the camera (device‑dependent). |
onModelDownloadProgress | (event: ModelDownloadProgress) => void | () => {} | No | Callback for model download progress events. |
onBarcodeScan | (event: BarcodeScanResult) => void | () => {} | No | Callback when a barcode scan result is received. |
onImageCaptured | (event: ImageCaptureEvent) => void | () => {} | No | Callback after an image has been captured. |
onOCRScan | (event: OCRScanResult) => void | () => {} | No | Callback for OCR scan results. |
onDetected | (event: DetectionResult) => void | () => {} | No | Callback for generic detection results (text, barcode, QR code, etc.). |
onCreateTemplate | (event: { data: 'created_template_id' }) => void | () => {} | No | Callback for receiving recently created template id. |
onDeleteTemplateById | (event: { data: 'deleted_template_id' }) => void | () => {} | No | Callback for receiving recently deleted template id. |
onDeleteTemplates | () => void | () => {} | No | Callback triggered when all templates are deleted successfully. |
onGetTemplates | (event) => void | () => {} | No | Callback that receives all available template ids. |
onBoundingBoxesDetected | (event: BoundingBoxesDetectedResult) => void | () => {} | No | Callback for receiving coordinates and dimensions for detected bounding boxes on screen. |
onPriceTagDetected | (event: PriceTagDetectionResult) => void | () => {} | No | Callback for price tag detection. |
onError | (event: ErrorResult) => void | () => {} | No | Callback when an error occurs within the SDK. |
# VisionSdkRefProps — Imperative Methods Reference
| Method | Parameters | Return | Description | Example |
|---|---|---|---|---|
stopRunningHandler | — | void | Stops any ongoing process in the Vision SDK (e.g. scanning or image processing). | visionSdkRef.current.stopRunningHandler() |
cameraCaptureHandler | — | void | Triggers the camera to capture an image for processing. | visionSdkRef.current.cameraCaptureHandler() |
restartScanningHandler | — | void | Restarts the scanning process after it has been stopped or interrupted. | visionSdkRef.current.restartScanningHandler() |
startRunningHandler | — | void | Starts the scanning or image‑processing task in the Vision SDK. | visionSdkRef.current.startRunningHandler() |
setMetadata | value: any | void | Sets arbitrary metadata to be sent along with the next capture or scan. | visionSdkRef.current.setMetadata({ orderId: 12345, customerName: 'John Doe' }) |
setRecipient | value: any | void | Sets recipient details (e.g. name, address) for shipping‑label workflows. | visionSdkRef.current.setRecipient({ name: 'Jane Smith', address: '123 Main St' }) |
setSender | value: any | void | Sets sender details (e.g. name, address) for shipping‑label workflows. | visionSdkRef.current.setSender({ name: 'John Doe', address: '456 Elm St' }) |
configureOnDeviceModel | payload: { type: ModuleType; size?: ModuleSize }, token?: string, apiKey?: string | void | Configures which on‑device model to use (e.g. item_label, shipping_label) and optionally its size. | visionSdkRef.current.configureOnDeviceModel({ type: 'item_label', size: 'small' }) |
getPrediction | image: any, barcode: string[] | void | Processes an image plus barcodes client‑side (on‑device) to get a prediction. | visionSdkRef.current.getPrediction(image, ['1234567890']) |
getPredictionWithCloudTransformations | image: any, barcode: string[], token?: string, apiKey?: string, locationId?: string, options?: any, metadata?: any, recipient?: any, sender?: any, shouldResizeImage?: boolean | void | Sends image & barcode to cloud with optional resizing and extra context for advanced transformations. | visionSdkRef.current.getPredictionWithCloudTransformations(image, ['1234567890']) |
getPredictionShippingLabelCloud | image: any, barcode: string[], token?: string, apiKey?: string, locationId?: string, options?: Record<string, any>, metadata?: any, recipient?: any, sender?: any, shouldResizeImage?: boolean | void | Sends a shipping‑label image & barcodes to cloud for OCR/prediction. | visionSdkRef.current.getPredictionShippingLabelCloud(image, ['9876543210']) |
getPredictionBillOfLadingCloud | image: any, barcode: string[], token?: string, apiKey?: string, locationId?: string, options?: Record<string, any>, shouldResizeImage?: boolean | void | Sends a bill‑of‑lading image & barcodes to cloud for OCR/prediction. | visionSdkRef.current.getPredictionBillOfLadingCloud(image, ['1234567890']) |
getPredictionItemLabelCloud | image: string, token?: string, apiKey?: string, shouldResizeImage?: boolean | void | Sends an item‑label image to cloud for OCR/prediction. | visionSdkRef.current.getPredictionItemLabelCloud(image) |
getPredictionDocumentClassificationCloud | image: string, token?: string, apiKey?: string, shouldResizeImage?: boolean | void | Sends a document image to cloud for classification & OCR. | visionSdkRef.current.getPredictionDocumentClassificationCloud(image) |
reportError | payload: ReportErrorType, token?: string, apiKey?: string | void | Reports a custom error (with type & size) to the SDK for debugging or telemetry. | visionSdkRef.current.reportError({ reportText: 'Error processing image.', type: 'shipping_label', size: 'small' }) |
createTemplate | callback?: (res: any, err: any) => void | void | Creates a new template in the SDK. | visionSdkRef.current.createTemplate((res, err) => { /* ... */ }) |
getAllTemplates | — | void | Retrieves all saved templates from the SDK. | visionSdkRef.current.getAllTemplates() |
deleteTemplateWithId | id: string | void | Deletes a specific template by its ID. | visionSdkRef.current.deleteTemplateWithId('template123') |
deleteAllTemplates | id: string | void | Deletes all templates stored in the SDK. (takes a dummy id param) | visionSdkRef.current.deleteAllTemplates() |
setFocusSettings | settings: any | void | Configures the SDK's camera focus settings (e.g. autoFocus). | visionSdkRef.current.setFocusSettings({ autoFocus: true }) |
setFocusSettings | settings: any | void | Configures the SDK’s camera focus settings (e.g. autoFocus). | visionSdkRef.current.setFocusSettings({ autoFocus: true }) |
setObjectDetectionSettings | settings: any | void | Configures object‑detection parameters (e.g. confidence threshold). | visionSdkRef.current.setObjectDetectionSettings({ confidenceThreshold: 0.85 }) |
setCameraSettings | settings: any | void | Configures camera parameters (e.g. resolution, exposure) for optimal capture. | visionSdkRef.current.setCameraSettings({ resolution: 'high', exposure: 'auto' }) |
# 📝 VisionCore Methods
For camera-independent OCR prediction and logging operations, use the VisionCore module instead of the component ref methods:
- Headless OCR Prediction: Use
VisionCore.predict(),VisionCore.predictShippingLabelCloud(), etc. — See Documentation - Data Logging: Use
VisionCore.logItemLabelDataToPx(),VisionCore.logShippingLabelDataToPx()— See Documentation
import { VisionCore } from 'react-native-vision-sdk';
// Camera-independent prediction
const result = await VisionCore.predictShippingLabelCloud(imageUri, [], options);
// Data logging
await VisionCore.logItemLabelDataToPx(imageUri, barcodes, responseData, token, apiKey, true, metadata);