0.0.3 • Published 7 years ago

react-native-zbar-android v0.0.3

Weekly downloads
6
License
MIT
Repository
github
Last release
7 years ago

react-native-zbar-android

npm version npm version

Fast QR Code Scanner for Android based on https://github.com/ZBar/ZBar

Demo

npm.io

Installation Android

  1. npm install react-native-zbar-android --save
  2. react-native link react-native-zbar-android

Usage

import { startScan } from 'react-native-zbar-android'
import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  ToastAndroid,
  View
} from 'react-native';

class MyPickers extends Component {

  render () {
    startScan(this._onBarCodeRead.bind(this))
    return (
      <View/>
    )
  }

  _onBarCodeRead (QRCodeResult) {
    if (QRCodeResult.state === 'ok') {
      let result = QRCodeResult.code
      ToastAndroid.show(result, ToastAndroid.SHORT);
    }
  }
}

Questions or suggestions?

Feel free to open an issue