onBarCodeRead method is getting triggered without scanning QR code or any type of code
Author: leoamato10Created Dec 28, 2021Updated Apr 15, 2023
onBarCodeRead method is getting triggered without scanning qr. Its only an android issue.
Im using react-native-qrcode-scanner 1.5.4 and react-native-camera 4.2.1 version. Devices used Samsung s9 and Samsung s21 ultra and s10+.
When the RNCamera component is loaded at random time and with the cellphone pointing to the floor it triggers the onBarCodeRead method (I don't know why). It was difficult for me to reproduce this error because I couldn't find a pattern or specific behavior to make it appear.
This is my RNCamera component code:
If you have any suggestions or ideas please let me know I will be extremely grateful . Also if you need more information just let me know.
i think its related with #2828
<RNCamera>
androidCameraPermissionOptions={{
title: this.props.permissionDialogTitle,
message: this.props.permissionDialogMessage,
buttonPositive: this.props.buttonPositive,
}}
style={[styles.camera, this.props.cameraStyle]}
onBarCodeRead={this._handleBarCodeRead.bind(this)}
barCodeTypes={[Camera.Constants.BarCodeType.qr]}
type={this.props.cameraType}
flashMode={this.props.flashMode}
captureAudio={false}
{...this.props.cameraProps}
>
{this._renderCameraMarker()}
</RNCamera>
Source: react-native-camera/react-native-camera