Expo-camera onBarCodeScanned works only once

I’m trying to make an android app that basically has to be able to continuously scan Qr codes. It looks something like this (unuseful parts omitted):

const QRScanner = () => {

    const [scanned, setScanned] = useState(false);
    const [result, setResult] = useState('Nothing scanned yet');

    const scanHandler = ({type, data}) => {
        setScanned(true);
        setResult(data);
        
        setTimeout(() => {
            setScanned(false);
        }, 3000);
    }

    return (
        <View>
            <Camera
                onBarcodeScanned={scanned ? undefined: scanHandler}
            >
                <Text>{result}</Text>
            </Camera>
        </View>
    )
}

Unfortunatly it seems that during the execution the Camera module is able to scan a barcode of any sort only once. This should have been solved with expo’s release version 45.0.6 (as shown here) but even after the update I have the same problem.

Any help is appreciated.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.