BarcodeScanner does not close until the App has been restartet.

Please provide the following:

  1. SDK Version: 46
  2. Platforms(Android/iOS/web/all): Android

I’m using the BarcodeScanner plugin from expo to simpy scann a code and put it into an Input field.
So far so good my code works fine.
Just a small Problem. After I scanned a code and dissabled the Tag with a State that tells my application if I want to scann right now or not, the Barcodescanner seems to be still active in the Background.
I first noticed it on Android 12 because my NFC would not work anymore until I restartet the app.
No I Also noticed that Otherfunctions like a Flashlight or some programmable buttons stop working after I Scanned a barcode.

I saw that other people here seem to have the same problem with the camera but apperently no one could help them nor me.

So after I expermentet for a long while on my own I ask again. Has anyone found a solution or a way to fully close the Barcodescanner during the App runtime?

Btw. how I implemented the scanner:
{isCamera && (
<View
style={{
height: “100%”,
backgroundColor: “#000000”,
}}
>
<View
style={{
alignItems: “flex-end”,
position: “absolute”,
top: 0,
right: 0,
zIndex: 1,
}}
>
<TouchableOpacity
onPress={() => {
setCamera(false);
}}
style={{
width: 50,
height: 50,
justifyContent: “center”,
alignItems: “center”,
padding: 2,
borderRadius: 100,
backgroundColor: “rgb(0,0,0,0)”,
marginRight: 10,
}}
>



<BarCodeScanner
onBarCodeScanned={scanned ? undefined : handleBarCodeScanned}
style={StyleSheet.absoluteFillObject}
>

)}

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