由于 Google Play 的原因,我必须将我的一个旧项目更新到最新的 expo 版本(确切地说是版本 43.0.0)。这个想法是让应用程序扫描二维码并简单地处理数据。但是,expo-barcode-scanner 只能工作一次,之后我需要关闭并再次打开应用程序才能工作。有没有人遇到过这个问题并且(或)知道如何解决它?下面是我的代码:
{escaneando ? (
<BarCodeScanner
barCodeTypes={[
BarCodeScanner.Constants.BarCodeType.ean13,
BarCodeScanner.Constants.BarCodeType.ean8,
BarCodeScanner.Constants.BarCodeType.upc_a,
BarCodeScanner.Constants.BarCodeType.upc_e,
]}
onBarCodeScanned={this.handleBarCode.bind(this)}
style={[StyleSheet.absoluteFillObject, styles.barscan]}
/>
) : null}
Run Code Online (Sandbox Code Playgroud)
及库规格:
"@react-native-community/masked-view": "^0.1.11",
"@react-native-community/netinfo": "^6.0.5",
"@react-navigation/native": "^6.0.6",
"@react-navigation/stack": "^6.0.11",
"expo": "~43.0.0",
"expo-av": "^10.1.3",
"expo-barcode-scanner": "^11.1.2",
"expo-status-bar": "~1.1.0",
"lodash": "^4.17.21",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-native": "^0.64.2",
"react-native-dropdownalert": "^4.3.0",
"react-native-elements": "^3.4.2",
"react-native-gesture-handler": "^1.10.3",
"react-native-in-app-notification": "^3.2.0",
"react-native-offline": "^6.0.0",
"react-native-paper": "^4.10.0",
"react-native-reanimated": "^2.2.3",
"react-native-safe-area-context": "^3.3.2",
"react-native-screens": "^3.9.0",
"react-native-web": "0.17.1",
"react-navigation": "^4.4.4",
"react-redux": "^7.2.6",
"redux": "^4.1.2",
"redux-thunk": "^2.4.0",
"reselect": "^4.1.2"
Run Code Online (Sandbox Code Playgroud)