moaazsidat / react-native-qrcode-scanner

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

QRcode is not read #217

Open leandrosouzaa opened 4 years ago

leandrosouzaa commented 4 years ago

What's happening?

I'm starting with this library. I copied exactly the code that is made available from the documentation however when executing it I have no answer. Not even the vibration produced by reading Qrcode is performed

How can it be reproduced?

import React, { Component } from 'react';
import { View, Text, Dimensions, StyleSheet, TouchableOpacity, } from 'react-native';
import QRCodeScanner from "react-native-qrcode-scanner";

export default class QRcodeScan extends Component {

  onSuccess = (e) => {
    console.log(e)
  }

  render() {
    return (
      <QRCodeScanner
        onRead={this.onSuccess}
        topContent={
          <Text style={styles.centerText}>
            Go to <Text style={styles.textBold}>wikipedia.org/wiki/QR_code</Text> on your computer and scan the QR code.
          </Text>
        }
        bottomContent={
          <TouchableOpacity style={styles.buttonTouchable}>
            <Text style={styles.buttonText}>OK. Got it!</Text>
          </TouchableOpacity>
        }
      />
    );
  }
}

const styles = StyleSheet.create({
  centerText: {
    flex: 1,
    fontSize: 18,
    padding: 32,
    color: '#777',
  },
  textBold: {
    fontWeight: '500',
    color: '#000',
  },
  buttonText: {
    fontSize: 21,
    color: 'rgb(0,122,255)',
  },
  buttonTouchable: {
    padding: 16,
  },
});
raphaelv619 commented 4 years ago

Same here..

tungns4-topica commented 4 years ago

Same here..

raphaelAdekz commented 4 years ago

I tested on 3 different phones and it worked on just one.

Android 6.0.1 - not worked

Android 7.0 - not worked

Android 7.1 - worked

raphaelAdekz commented 4 years ago

In my case I was scanning a very large QRCode, and in some phones it worked and in others not, when it decreases the QRCode size it worked in all

leandrosouzaa commented 4 years ago

In my case, I entered the basic QRCode scanner code and reinstalled the app on the device. This made the application work normally, from time to time it would stop reading, I just had to reinstall the application to get everything back to normal.

TeruyaHaroldo commented 4 years ago

I am using the react-native-camera version 3.8.0 and everything is working.

const { height, width } = Dimensions.get('window');

<Camera
  style={{ height: height, width: width }}
  onBarCodeRead={(e) => console.log(e.data)}            
  androidCameraPermissionOptions={null}
  pendingAuthorizationView={<My View behind the dialog that is asking for permission />}
  notAuthorizedView={<My View that shows that user declined permission />}
>
</Camera>
vipindhangar1107 commented 4 years ago

Update QRCodeScanner like this :

<QRCodeScanner flashMode={Camera.Constants.FlashMode.off}
onRead={(e) => this.onSuccess(e)}
topContent={

                }
            />
moaazsidat commented 4 years ago

Is there something actionable from here that needs to be updated in the library or it's examples?

leandrosouzaa commented 4 years ago

Is there something actionable from here that needs to be updated in the library or it's examples?

Only examples

GhayoorUlHaq commented 3 years ago

I am using the react-native-camera version 3.8.0 and everything is working.

const { height, width } = Dimensions.get('window');

<Camera
  style={{ height: height, width: width }}
  onBarCodeRead={(e) => console.log(e.data)}            
  androidCameraPermissionOptions={null}
  pendingAuthorizationView={<My View behind the dialog that is asking for permission />}
  notAuthorizedView={<My View that shows that user declined permission />}
>
</Camera>

Not worked for me 😕