Is it possible to enable torch for expo-barcode-scanner?

Viewed 18

I have a simple qr-code reader app, and I wonder if can toogle the camera flashlight with a button.

const [torch, setTorch] = useState(false)

    <BarCodeScanner
    onBarCodeScanned={handleBarCodeScanned}
    style={{width:'100%', height:'100%'}}
    //Is there any flashlight modifier here?
    />

<Button title="turn on torch" onPress={()=>{setTorch(!torch)}}/>

Is this possible somehow?

1 Answers

You can't do this with the expo-barcode-scanner module, but you can use the expo-camera module to scan barcodes and use the flashMode prop to turn on the camera flash.

Related