1.0.2 • Published 7 years ago

ac-qrcode-bl v1.0.2

Weekly downloads
8
License
Apache-2.0
Repository
github
Last release
7 years ago

1.Guide

2.Features

  • Can scan QR code,Bar code
  • Support Android and iOS
  • Base on react-native-camera
  • Scanning interface can be customized

3.ScreenShots

TwitterWeChatOFO
npm.ionpm.ionpm.io
QQBrowserGif1Gif2
npm.ionpm.ionpm.io

4.Installation

// first step
npm install ac-qrcode --save

// second step
react-native link

5.Basic Usage

import { QRScannerView } from 'ac-qrcode';

export default class DefaultScreen extends Component {
    render() {
        return (

            < QRScannerView
                onScanResultReceived={this.barcodeReceived.bind(this)}

                renderTopBarView={() => this._renderTitleBar()}

                renderBottomMenuView={() => this._renderMenu()}
            />
        )
    }

    _renderTitleBar(){
        return(
            <Text
                style={{color:'white',textAlignVertical:'center', textAlign:'center',font:20,padding:12}}
            >Here is title bar</Text>
        );
    }

    _renderMenu() {
        return (
            <Text
                style={{color:'white',textAlignVertical:'center', textAlign:'center',font:20,padding:12}}
            >Here is bottom menu</Text>
        )
    }

    barcodeReceived(e) {
        Toast.show('Type: ' + e.type + '\nData: ' + e.data);
        //console.log(e)
    }
}

6.Props

npm.io

PropTypeDefaultOptionalDescription
maskColorstring#0000004Dtrue
borderColorstring#000000true
cornerColorstring#000000true
borderWidthnumber0true
cornerBorderWidthnumber4true
cornerBorderLengthnumber20true
rectHeightnumber200true
rectWidthnumber200true
isCornerOffsetboolfalsetrue
cornerOffsetSizenumber0true
bottomMenuHeightnumber0true
scanBarAnimateTimenumber2500true
scanBarColorstring#22ff00true
scanBarImageanynulltrue
scanBarHeightnumber1.5true
scanBarMarginnumber6true
hintTextstring将二维码/条码放入框内,即可自动扫描true
hintTextStyleobject{ color: '#fff', fontSize: 14,backgroundColor:'transparent'}true
hintTextPositionnumber130true
isShowScanBarbooltruetrue
bottomMenuStyleobject-true
renderTopBarViewfunc-flase
renderBottomMenuViewfunc-false
onScanResultReceivedfunc-false
torchModestringnulltrueIndicate the torch mode, "on" or "off"

7.To Do

  • Generate qr code
  • Control flashlight

8.Thanks

9.About Me