App crashes when scanning a barcode using Expo's BarCodeScanner
I am very new to programming and expo, so I apologize in advance for the lack of precision.
I made an application using Expo 34.0.1 where I use expo’s expo-barcode-scanner. The app works perfectly on expo start
; however, when I run expo build:android
the scanning fails. The camera opens but as soon as a code is scanned, the app restarts.
(I didn’t test it on IOS)
"expo": "^34.0.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-34.0.0.tar.gz",
"sdkVersion": "33.0.0",
import { BarCodeScanner } from 'expo-barcode-scanner';
import * as Permissions from 'expo-permissions';
<BarCodeScanner
onBarCodeScanned={this.handleBarCodeScanned}
style={StyleSheet.absoluteFill}
>
</BarCodeScanner>
I expect it to work as in development but instead the app restarts as soon as a code is scanned
Thank you!
The issue is from how your permission is set. You need to check where your permission is being called from. I have mine being called from componentWillMount()