react-native-rn-zxing

1.1.2 • Public • Published

react-native-rn-zxing

🔥 Finally 🔥 ... an easy way to implement an efficient QR Code scanner (Zxing based) using React native.

Getting started

$ npm install react-native-rn-zxing --save

Mostly automatic installation

$ react-native link react-native-rn-zxing

Manual installation

Android

  1. Open up android/app/src/main/java/[...]/MainActivity.java
  • Add import com.reactlibrary.RnZxingPackage; to the imports at the top of the file
  • Add new RnZxingPackage() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle:
    include ':react-native-rn-zxing'
    project(':react-native-rn-zxing').projectDir = new File(rootProject.projectDir, 	'../node_modules/react-native-rn-zxing/android')
    
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
      compile project(':react-native-rn-zxing')
    

Usage

import RnZxing from 'react-native-rn-zxing';
 
...
// Pass the callback as a parameter
RnZxing.showQrReader(this.onBarcodeScanned);
 
...
// Define the callback function to handle data after scan
onBarcodeScanned = (data) => {
        this.setState({data: data});
};
 

Package Sidebar

Install

npm i react-native-rn-zxing

Weekly Downloads

8

Version

1.1.2

License

none

Unpacked Size

5.05 kB

Total Files

8

Last publish

Collaborators

  • azamani