react-native-scan-code-cn

最近要用到扫描,一开始用的react-native-camera,但是没有后置摄像头光源捕捉,不能做到和微信支付宝一样的手电筒逻辑,那就自己写一个

Install

yarn add react-native-scan-code-cn
或者
npm install react-native-scan-code-cn --save

Configuration

  • android
  1. run npx jetify
  2. In android/app/src/main/AndroidManifest.xml add:

  • ios
  1. run npx pod-install

Usage

Make sure permissions are turned on before using

import { RNScanCode } from 'react-native-scan-code-cn'

 {
        console.log('扫码结果 = ', res)
    }}
    onLightBright={light => {
        console.log('当前的光源= ', light)
    }}
>
    
    {/* 其他UI */}

你可能感兴趣的:(react-native-scan-code-cn)