Skip to content

Issue: Barcode Scanning Fails After Multiple Scans #696

Open
@aravind3566

Description

@aravind3566

I'm encountering an issue where the barcode scanner fails to read QR codes consistently after the second or third scan. It works fine initially, but after a few successful scans, the onReadCode event stops triggering, and the QR codes are no longer detected.

const onBarcodeScan = (event) => {
    resetTimer();
    cancelAlertToast();
    const urlString = event?.nativeEvent?.codeStringValue;

    if (!isScanningAllowed) {
        return;
    } else {
        setScanningAllowed(false);
        ProcessQrCode(urlString);
    }}
{
    isCameraActive && cameraPermission ? (
        <View style={{ flex: 1 }}>
            <Camera
                ref={(ref) => (cameraRef.current = ref)}
                flashMode="auto"
                focusMode="off"
                zoomMode="on"
                style={[styles.camerascreen]}
                torchMode={torchswitch}
                cameraType={!cameraState ? CameraType.Back : CameraType.Front}
                scanBarcode={true}
                resizeMode="cover"
                onReadCode={(event) => onBarcodeScan(event)}
            />
        </View>
    ) : (
        <View></View>
    )
}

Expected behavior
The scanner should consistently detect QR codes regardless of how many scans are performed.

Observed Behavior

  1. First scan works perfectly.
  2. Second or third scan starts failing randomly.
  3. onReadCode doesn’t trigger even when QR code is clearly visible.

Smartphone (please complete the following information):

  • Device: Samsung Tab A
  • OS: Android 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions