Socket
Book a DemoInstallSign in
Socket

react-native-scanzy-barcode-scanner-plugin

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-scanzy-barcode-scanner-plugin

Scanzy barcode scanner plugin for React Native platform

latest
npmnpm
Version
0.0.4
Version published
Maintainers
1
Created
Source

react-native-scanzy-barcode-scanner-plugin

react-native-scanzy-barcode-scanner-plugin implements the barcode capture capabilities of the ScanzyBarcodeScannerSDK for iOS and Android. It supports reading a large number of different barcode symbologies, such as Code39, Code93, Code128, Codabar, UPC-A, UPC-E, EAN-8, EAN-13, ITF, QRCode, Aztec, PDF-417, Data Matrix, etc.

Learn more with the documentation or get started with sample

Prerequisites

Installation

npm install react-native-scanzy-barcode-scanner-plugin

For ios project, in order to get camera permission, please add below configs to the Info.plist of the Project Targets.

<key>NSCameraUsageDescription</key>
<string>camera description.</string>

For android project, add the following config in the same build.gradle(Android/app/build.gradle) file to avoid conflicts with the lib filename libc++_shared.so, which is used by React Native as well as by many other 3rd-party modules:

android {  
    ...  
    packagingOptions {      
        pickFirst '**/libc++_shared.so'  
    }
}

Usage

import ScanzyBarcodeManager, {ScanzyBarcodeFormat, ScanzyBarcodeOptions} from 'react-native-scanzy-barcode-scanner-plugin';

//set lisense in your app init function
ScanzyBarcodeManager.setLicense('YOUR LICENSE KEY');

//set scan formats and options
const formats = [ScanzyBarcodeFormat.Code128, ScanzyBarcodeFormat.Code93, ScanzyBarcodeFormat.EAN13, ScanzyBarcodeFormat.QRCode];
const options: ScanzyBarcodeOptions = {
  enableVibration: true,
  enableBeep: true,
  enableAutoZoom: false,
  enableScanCropRectOnly: false,
  formats: formats
}

// scan
ScanzyBarcodeManager.scan(options).then((result: ScanzyBarcodeScanResult)=>{
  //get the scan result
  console.log('Scan Result:', result.barcode, result.barcodeType)
})

API Specification

Below gives you more details about the parameters:

The definition of ScanzyBarcodeFormat:

const ScanzyBarcodeFormat = {
  Code128:"Code128",
  Code39:"Code39",
  Code93:"Code93",
  CodaBar:"CodaBar",
  DataMatrix:"DataMatrix",
  EAN13:"EAN13",
  EAN8:"EAN8",
  ITF:"ITF",
  QRCode:"QRCode",
  UPCA:"UPCA",
  UPCE:"UPCE",
  PDF417:"PDF417",
  Aztec:"Aztec",
  MaxiCode:"MaxiCode"
}

Note: to set the formats you only interested, although you can add ALL formats, it definitely would impact the performance.

The ScanzyBarcodeOptions is defined as:

interface ScanzyBarcodeOptions {
  enableVibration?: boolean;
  enableBeep?: boolean;
  enableAutoZoom?: boolean;
  enableScanCropRectOnly?: boolean;
  formats?: string[];
}

enableVibration: vibrate your phone when barcode detected.

enableBeep: play the beep sound when barcode detected.

enableAutoZoom: the library will zoom in/out automatcially to scan the barcode.

enableScanCropRectOnly: only scan the view finder area.

formats: the barcode formats.

The ScanzyBarcodeScanResult is defined as:

interface ScanzyBarcodeScanResult {
  barcode: string;
  barcodeType: string;
}

Support

if you have any questions or need help, check out our official website. Get a free trial license to try. It won't take more than one hour to integrate, insanely simple!

Keywords

react-native

FAQs

Package last updated on 24 Mar 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.