Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
scandit-sdk-react
Advanced tools
React component for the Scandit WebSDK.
Enterprise barcode scanning performance in your browser via JavaScript and WebAssembly.
Made by Scandit
Access cameras available on the devices for video input, display a barcode picker interface, configure in-depth settings for barcode symbologies and performance, and let users easily scan barcodes in your web application.
To use this library you must possess a valid Scandit account and license key. You can register for a free trial here.
Table of Contents:
Run npm install scandit-sdk --save
to install the WebSDK library and save it to your dependencies.
In the component where you want to use it, add the ScanditBarcodeScanner
component to your app:
import the needed parts:
import ScanditBarcodeScanner from "scandit-sdk-react";
import optional parts from the main Scandit WebSDK if needed:
import {
Barcode,
BarcodePicker,
Camera,
CameraAccess,
CameraSettings,
ScanSettings,
SingleImageModeSettings,
} from "scandit-sdk";
Add the component to your render function:
<ScanditBarcodeScanner
// Library licensing & configuration options (see https://docs.scandit.com/stable/web/globals.html#configure)
licenseKey={this.licenseKey}
engineLocation="https://cdn.jsdelivr.net/npm/scandit-sdk@5.x/build" // could also be a local folder, e.g. "build"
// Picker events
onReady={() => this.setState({ scannerReady: true })}
onScan={console.log}
onScanError={console.log}
// Picker options
scanSettings={this.getScanSettings()}
/>
For the above example you also need in your component the following (example), to retrieve the scan settings:
getScanSettings = () => {
return new ScanSettings({ enabledSymbologies: [Barcode.Symbology.CODE128] });
};
For a fully customized picker, see the example below:
<ScanditBarcodeScanner
licenseKey={this.licenseKey}
engineLocation="https://cdn.jsdelivr.net/npm/scandit-sdk@5.x/build"
preloadBlurryRecognition={true}
preloadEngine={true}
onReady={console.log}
onScan={console.log}
onScanError={console.log}
onSubmitFrame={console.log}
onProcessFrame={console.log}
scanSettings={this.getScanSettings()}
paused={false}
/*️
⚠️ Make sure to keep accessCamera and paused synchronized in a sensible way, as resuming scanning accesses
the camera, so your state might become outdated.
For example, set accessCamera to true whenever scanning is resumed.
*/
accessCamera={true}
camera={undefined}
cameraSettings={undefined}
enableCameraSwitcher={true}
enablePinchToZoom={true}
enableTapToFocus={true}
enableTorchToggle={true}
guiStyle={BarcodePicker.GuiStyle.LASER}
laserArea={{ x: 0, y: 0, width: 1, height: 1 }}
playSoundOnScan={true}
targetScanningFPS={30}
vibrateOnScan={true}
videoFit={BarcodePicker.ObjectFit.CONTAIN}
visible={true}
viewfinderArea={{ x: 0, y: 0, width: 1, height: 1 }}
zoom={0}
// only set on component creation, can not be changed afterwards
cameraType={Camera.Type.BACK}
singleImageModeSettings={this.getSingleImageModeSettings()}
/>
For the above example you also need in your component the following (example), to retrieve the single image mode settings:
getSingleImageModeSettings = () => {
return {
desktop: {
usageStrategy: SingleImageModeSettings.UsageStrategy.FALLBACK,
},
mobile: {
usageStrategy: SingleImageModeSettings.UsageStrategy.FALLBACK,
},
};
};
This component has been made to follow the BarcodePicker
creation parameters and methods available in the main Scandit WebSDK library. In addition to that it also integrates the parameters for its configuration. Please refer to the demo application code, WebSDK BarcodePicker documentation and WebSDK configuration documentation for available options and details.
singleImageMode
attribute is now replaced by singleImageModeSettings
, accepting a newly structured settings object.onScannerInitialized
and scanner
attributes are not available anymore, optimal performance regarding reuse of internal parts is now automatically handled by the library as part of the component's lifecycle.For questions or support please use the form you can find here or send us an email to support@scandit.com.
This project is licensed under the Apache License, Version 2.0.
In case you want to work and modify the component itself.
npm install
in the component's root directory will install everything you need for development.npm start
will run a development server with the component's demo app at http://localhost:3000 with hot module reloading.npm run build
will build the component and also bundle the demo app.npm run clean
will delete built resources.FAQs
Scandit Barcode Scanner SDK for the Web - React Component
The npm package scandit-sdk-react receives a total of 1,032 weekly downloads. As such, scandit-sdk-react popularity was classified as popular.
We found that scandit-sdk-react demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.