shifeng1993 / react-native-qr-scanner

一个二维码扫描组件,依赖react-native-camera
MIT License
116 stars 65 forks source link

how can i re-activate the scanner? #1

Closed hasgardee closed 6 years ago

hasgardee commented 6 years ago

After one qr scan is done nothing happening, is there any option to re-active scanner again ? if no please add that

seeya commented 6 years ago

I did it this way. Set a parameter key in the declaration of your component like this:

<QRScannerView key={this.state.key} onRead={this.onRead} torchMode={false} hintText="Scan QR code"/>

Then upon scanning the value, increment the key count to another number. This will re-render the component.

onRead = ({data}) => {
    this.setState({
      key: this.state.key + 1
    });
  }
shifeng1993 commented 6 years ago

1.2.2 版本已添加,此类问题会在三日后关闭