moaazsidat / react-native-qrcode-scanner

A QR code scanner component for React Native.
MIT License
2.04k stars 517 forks source link

Barcode scanning #84

Open Adwich opened 6 years ago

Adwich commented 6 years ago

Hello everyone, I'm using react-native-qrcode-scanner to scan qrcode and it work great. But I saw that it also can read barcodes given that react native camera can. My problem is that I've tried with barcodes but I can't get any reading.

What's happening?

I can't scan a barcode.

How can it be reproduced?

Here is the code I'm using. I've tried scanning all the barcode I have. To reproduce it just try scanning any barcode.

import QRCodeScanner from 'react-native-qrcode-scanner';
/* ... */
onRead = e => {
       console.log(e);
}
/*...*/

render() {
  return (
<QRCodeScanner
       onRead={this.onRead.bind(this)}
    ref={node => {
        this.scanner = node;
    }}
    reactivateTimeout={300}
/>
)}

Build details?

I'm working on Android with these :

"react": "^16.2.0",
"react-native": "^0.51.1",
"react-native-camera": "^1.0.3",
"react-native-qrcode-scanner": "^1.0.1"
moaazsidat commented 6 years ago

Wondering if it's working fine with QR codes?

Adwich commented 6 years ago

Yeah no problem regarding scanning a Qrcode. But for any barcode I can't get it to work. Is there a specific setting to be able to scan one ?

moaazsidat commented 6 years ago

Hmm, it shouldn't be preventing that, there is a setting to scan different types in react-native-camera, but by default it should be supporting all types, look at the doc link below, as well as the barCodeTypes prop below onBarCodeRead: https://github.com/react-native-community/react-native-camera/blob/master/docs/RNCamera.md#onbarcoderead

Adwich commented 6 years ago

I finally found that i can only scan barcode if my phone is scanning while oriented in landscape. I get the same behaviour in react-native-camera.

Anyway, thank you guys for your help

mark5566 commented 6 years ago

I get the same result scanning barcode while oriented in landscape