react-native-qrcode-scanner
react-native-qrcode-scanner copied to clipboard
QRcode is not read
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,
},
});
Same here..
Same here..
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
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
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.
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>
Update QRCodeScanner like this :
<QRCodeScanner
flashMode={Camera.Constants.FlashMode.off}
onRead={(e) => this.onSuccess(e)}
topContent={
<Text style={styles.centerText}>
</Text>
}
/>
Is there something actionable from here that needs to be updated in the library or it's examples?
Is there something actionable from here that needs to be updated in the library or it's examples?
Only examples
I am using the
react-native-cameraversion 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 😕