react-native-zxing

1.0.11 • Public • Published

React Native Zxing npm version npm downloads

The comprehensive zxing module for React Native (Android).

This module abstracts the library zxing-android-embedded, developed by JourneyApps

Barcode formats:

  • UPC A
  • UPC E
  • EAN 8
  • EAN 13
  • RSS 14
  • CODE 39
  • CODE 93
  • CODE 128
  • ITF
  • RSS EXPANDED
  • QR CODE
  • DATA MATRIX
  • PDF 417

Example

Example import

import {NativeModules} from 'react-native';
 
const ScannerModule = NativeModules.ScannerModule;

Getting started

Mostly automatic install with react-native

  1. npm install react-native-zxing --save
  2. react-native link react-native-zxing

Usage

openScanner()

Open Default Scanner screen

Examples

ScannerModule.openScanner(isBeepEnable, prompt, this.onBarcodeRead)

Notes

isBeepEnable : boolean 
prompt : String (Text to help the user) // if null, no text will be displayed
onBarcodeRead : Callback function

openCustomScanner()

Open Custom Scanner screen

Examples

ScannerModule.openCustomScanner(isBeepEnable, isOrientationLocked, barcodeTypes, this.onBarcodeRead)

Notes

isBeepEnable : boolean 
isOrientationLocked : boolean 
barcodeTypes : Array of barcode types
onBarcodeRead : Callback function

Example

import { NativeModules } from 'react-native';
 
const ScannerModule = NativeModules.ScannerModule;
 
onBarcodeRead = (barcode) => {
    //do something with barcode value
}
 
var barcodeTypes = [
    'QR_CODE', 
    'DATA_MATRIX', 
    'UPC_A', 
    'UPC_E',
    'EAN_8',
    'EAN_13',
    'RSS_14',
    'CODE_39',
    'CODE_93',
    'CODE_128',
    'ITF',
    'RSS_EXPANDED',
    'QR_CODE',
    'DATA_MATRIX',
    'PDF_417'
]
 
ScannerModule.openCustomScanner(true, true, barcodeTypes, this.onBarcodeRead)

Thanks to JourneyApps for the zxing-android-embedded library which I used to access Zxing library.

License

The MIT License (MIT)

Copyright (c) 2018 Rafael T Akiyama

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Package Sidebar

Install

npm i react-native-zxing

Weekly Downloads

10

Version

1.0.11

License

MIT

Unpacked Size

874 kB

Total Files

93

Last publish

Collaborators

  • rafaeltakiyama