React-natvie 二维码与条形码的实现

#1

#源码

react-native-barCode

采用React Native WebView组件实现的BarCode(条形码)、QRCode(二维码),其中QRCode的代码是参考
qrcode,修复了qrcode图片会出现滚动条问题。

实现的原理:在WebView组件下,用canvas组件画出BarCode、QRCode。

Install

安装包:

npm i react-native-barCode --save

通过引用import {BarCode,QRCode} from 'react-native-barcode-qrcode'来使用

Usage

import {BarCode,QRCode} from 'react-native-barcode-qrcode'
<BarCode    value={this.props.payCode}
            width="225"
            height="90"
            bgColor="#e7e7eb"
           />
    <QRCode value={this.props.payCode}
            bgColor="#fff"
            fgColor="#333"/>

效果如下:

1 Like
#2

这个已经不能用了,要用react-native-barcode-builder ,注意按github 上readme.md 里的来配制