SparkScan View
Defined in package com.scandit.datacapture.barcode.spark.ui
- SparkScanScanningBehavior
Added in version 8.6.0
The capture mode type of the SparkScanView.
- SINGLE
Added in version 8.6.0
Barcode capturing session is stopped after each scan.
- CONTINUOUS
Added in version 8.6.0
Keeps the barcode capturing session active for longer time.
- SparkScanPreviewBehavior
Added in version 8.6.0
The preview behavior type of the SparkScanView.
- DEFAULT
Added in version 8.6.0
After a scan with scanning behavior SparkScanScanningBehavior.SINGLE, or stopping scanning with scanning behavior SparkScanScanningBehavior.CONTINUOUS, camera moves to standby state and preview is hidden for maximum efficiency.
- PERSISTENT
Added in version 8.6.0
After a scan with scanning behavior SparkScanScanningBehavior.SINGLE, or stopping scanning with scanning behavior SparkScanScanningBehavior.CONTINUOUS, camera stays active and preview is visible for maximum precision.
- SparkScanMiniPreviewSize
Added in version 8.6.0
The size of the mini preview in SparkScanView.
- REGULAR
Added in version 8.6.0
Regular, smaller size of the mini preview.
- EXPANDED
Added in version 8.6.0
Expanded, larger size of the mini preview.
- SparkScanViewState
Added in version 8.6.0
The view state of SparkScanView.
- INITIAL
Added in version 8.6.0
The initial view state for a few moments after SparkScanView is created.
- IDLE
Added in version 8.6.0
SparkScan is displaying only the collapsed capture button.
- INACTIVE
Added in version 8.6.0
SparkScan is displaying an expanded capture button, and if the SparkScanPreviewBehavior of the current scanning mode is SparkScanPreviewBehavior.PERSISTENT, we are also displaying camera feed through the mini preview but no actual scanning is taking place. This state is reachable after scanning.
- ACTIVE
Added in version 8.6.0
We are actively recognising barcodes, mini preview and expanded capture button are visible.
- ERROR
Added in version 8.6.0
User returns SparkScanBarcodeFeedback.Error from the SparkScanView.feedbackDelegate. Mini preview is visible with a frozen frame and expanded capture button is visible. If capture button is tapped or after a SparkScanBarcodeErrorFeedback.resumeCapturingDelay timeout is reached we move to ACTIVE state.
- SparkScanViewUiListener
interface SparkScanViewUiListenerAdded in version 8.6.0
- onBarcodeFindButtonTap(view)
fun onBarcodeFindButtonTap(view: SparkScanView)
Added in version 8.6.0
Callback method that can be used to define an action that should be performed when barcode find button is tapped from the toolbar. Called from the main thread.
- onBarcodeCountButtonTap(view)
fun onBarcodeCountButtonTap(view: SparkScanView)
Added in version 8.6.0
Callback method that can be used to define an action that should be performed when barcode count button is tapped from the toolbar. Called from the main thread.
- onLabelCaptureButtonTap(view)
fun onLabelCaptureButtonTap(view: SparkScanView)
Added in version 8.6.0
Callback method that can be used to define an action that should be performed when label capture button is tapped from the toolbar. Called from the main thread.
- onViewStateChanged(newState)
fun onViewStateChanged(newState: SparkScanViewState)
Added in version 8.6.0
Callback method that will be called when SparkScanViewState changes. Called from the main thread.
- SparkScanView
class SparkScanViewAdded in version 8.6.0
SparkScan comes with a ready-to-use UI and scanning modes that are purpose-built to tackle high-volume scanning at close range. The SparkScanView integrates with any app without requiring app redesign or customization. It includes:
camera preview screen
large-sized scan button
quick access toolbar to adjust scanning settings
- onPause()
fun onPause()Added in version 8.6.0
Call this when the hosting screen is paused, for the correct functioning of the SparkScanView.
- onResume()
fun onResume()Added in version 8.6.0
Call this when the hosting screen resumes, for the correct functioning of the SparkScanView.
- feedbackDelegate
var feedbackDelegate: SparkScanFeedbackDelegate?
Added in version 8.6.0
Sets the feedback delegate. If no delegate is set, the default SparkScanBarcodeFeedback.Success feedback is emitted.
- uiListener
var uiListener: SparkScanViewUiListener?
Added in version 8.6.0
Sets the UI listener that receives callbacks for toolbar button taps and view state changes.
- hardwareTriggerSupported
val SparkScanView.hardwareTriggerSupported:
BooleanAdded in version 8.6.0
Returns whether the device supports listening for hardware button events. This is true for devices with api >= 28.
- prepareScanning()
fun prepareScanning()Added in version 8.6.0
- stopScanning()
fun stopScanning()Added in version 8.6.0
- startScanning()
fun startScanning()Added in version 8.6.0
Starts the scanning process. You can call this method if you want to trigger the scanning process without any user interaction.
- pauseScanning()
fun pauseScanning()Added in version 8.6.0
Pauses the scanning process. You can call this method if you want to trigger pausing the scanning process without any user interaction.
- showToast(text)
fun showToast(text: String)
Added in version 8.6.0
Shows a toast with text inside the mini preview.
- defaultBrush()
fun SparkScanView.defaultBrush(): Brush
Added in version 8.6.0
Returns the default brush used by the overlay.
- barcodeCountButtonVisible
var barcodeCountButtonVisible:
BooleanAdded in version 8.6.0
Indicates whether the barcode count button should be shown to the user.
Default is false.
- barcodeFindButtonVisible
var barcodeFindButtonVisible:
BooleanAdded in version 8.6.0
Indicates whether the barcode find button should be shown to the user.
Default is false.
- labelCaptureButtonVisible
var labelCaptureButtonVisible:
BooleanAdded in version 8.6.0
Indicates whether the label capture button should be shown to the user.
Default is false.
- targetModeButtonVisible
var targetModeButtonVisible:
BooleanAdded in version 8.6.0
Deprecated since version 8.5: This property will be removed in a future release.
Indicates whether the target mode button should be shown to the user.
Default is false.
- selectionModeButtonVisible
var selectionModeButtonVisible:
BooleanAdded in version 8.6.0
Indicates whether the selection mode button should be shown to the user. The button toggles SparkScanSettings.selectionMode between SelectionMode.ON and SelectionMode.OFF.
Renamed replacement for the deprecated targetModeButtonVisible. Both properties share the same underlying state; when a deserialised JSON snapshot contains both keys,
selectionModeButtonVisiblewins.Default is false.
- scanningBehaviorButtonVisible
var scanningBehaviorButtonVisible:
BooleanAdded in version 8.6.0
Indicates whether the scanning behavior button should be shown to the user.
Default is false.
- zoomSwitchControlVisible
var zoomSwitchControlVisible:
BooleanAdded in version 8.6.0
Indicates whether the zoom switch control should be shown to the user.
Default is true.
- triggerButtonVisible
var triggerButtonVisible:
BooleanAdded in version 8.6.0
Indicates whether the trigger button should be shown to the user.
Default is true.
- previewSizeControlVisible
var previewSizeControlVisible:
BooleanAdded in version 8.6.0
Indicates whether the mini preview size control should be shown to the user.
Default is true.
- torchControlVisible
var torchControlVisible:
BooleanAdded in version 8.6.0
Indicates whether the torch control should be shown to the user.
Default is true.
- previewCloseControlVisible
var previewCloseControlVisible:
BooleanAdded in version 8.6.0
Indicates whether the mini preview close control should be shown to the user.
Default is true.
- cameraSwitchButtonVisible
var cameraSwitchButtonVisible:
BooleanAdded in version 8.6.0
Indicates whether the camera switch button should be shown to the user.
Default is false.
Note
This API is still in beta and may change in future versions of Scandit Data Capture SDK.
- triggerButtonCollapsedColor
var triggerButtonCollapsedColor: Color?
Added in version 8.6.0
Sets the background color of the trigger button when button is collapsed.
- triggerButtonExpandedColor
var triggerButtonExpandedColor: Color?
Added in version 8.6.0
Sets the background color of the trigger button when button is expanded.
- triggerButtonAnimationColor
var triggerButtonAnimationColor: Color?
Added in version 8.6.0
Sets the color of the pulsing animation around the trigger button, which is shown when the scanner is active.
- triggerButtonTintColor
var triggerButtonTintColor: Color?
Added in version 8.6.0
Sets the trigger button tint color.
- toolbarBackgroundColor
var toolbarBackgroundColor: Color?
Added in version 8.6.0
Sets the toolbar background color.
Default is null.
- toolbarIconActiveTintColor
var toolbarIconActiveTintColor: Color?
Added in version 8.6.0
Sets the toolbar icon active color.
Default is null.
- toolbarIconInactiveTintColor
var toolbarIconInactiveTintColor: Color?
Added in version 8.6.0
Sets the toolbar icon inactive color.
Default is null.
- triggerButtonImage
var triggerButtonImage: InputImage?
Added in version 8.6.0
The image displayed in the trigger button.
Note
Troubleshooting: Buttons Not Working With Navigation Header
When using the SparkScanView component with React Navigation and headerShown: true, you may encounter an issue where the Buttons within your SparkScanView don’t respond to touch events. This is a known issue with React Navigation’s header implementation.
The Issue
The navigation header can interfere with touch event handling for components rendered within certain custom views like SparkScanView. While the buttons appear to be functioning visually, their onPress events do not trigger when the screen includes a header.
Solution
Try this workaround if you encounter this issue:
Use TouchableOpacity instead of Button
<TouchableOpacity onPressIn={() => handleButtonPress()}> <Text>Scan</Text> </TouchableOpacity>
or
<TouchableOpacity
onPressOut={() => handleButtonPress()}>
<Text>Scan</Text>
</TouchableOpacity>
Ensure you’re importing TouchableOpacity from ‘react-native’
Some users have found that using the TouchableOpacity component from ‘react-native-gesture-handler’ causes issues, while the one from ‘react-native’ works correctly.