@arlenwang/react-native-local-barcode-recognizer
v1.0.1
Published
React Native 从本地图像识别条形码的插件
Downloads
5
Maintainers
Readme
React native 本地二维码识别器
react-native-local-barcode-recognizer
安装:
#install:
npm install git+https://github.com/du6688/react-native-local-barcode-recognizer.git
#and link:
react-native link react-native-local-barcode-recognizer
用法:
import LocalBarcodeRecognizer from 'react-native-local-barcode-recognizer';
const imageBase64 = "data:image/jpeg;base64,/9j/4AA.......";
let result = await LocalBarcodeRecognizer.decode(imageBase64.replace("data:image/jpeg;base64,",""), {
codeTypes: ['ean13', 'qr']
});
console.log(result);
说明:
修改源码文件,修复二维码识别率过低的问题,添加了ts类型
优化方法参照 文章
API
| 方法 | 参数 | |:----:|:----:| | decode | (base64编码,options)=> Promise<string> |
options
| 名称 | 描述 | |:----:|:----:| | codeTypes |[aztec,ean13, ean8, qr, pdf417, upc_e, datamatrix, code39, code93, interleaved2of5, codabar, code128, maxicode, rss14, rssexpanded, upc_a, upc_ean] |