我是 Expo 的新手,我不知道这里有什么问题,我对 Android 已经足够好了,我正在尝试在一个新创建的空白 react-native expo 项目中使用react-native-qrcode-scanner 。我没有触及项目内部的任何内容,只是创建了一个全新的项目,我收到一个错误消息RNPermissions is null
。我认为它告诉传递有关我的 android 应用程序的详细信息,有人可以帮助我如何开始吗?我正在使用QR Code Scanner 的代码所需的react-native-permissions ,我卸载了依赖项中的所有内容,只留下了这些:
"dependencies": {
"expo": "~36.0.0",
"react": "~16.9.0",
"react-dom": "~16.9.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz",
"react-native-permissions": "^2.0.2",
"react-native-web": "~0.11.7"
}
所以只有基本的欢迎在 App.js 中响应消息,如下所示:
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { check, PERMISSIONS, RESULTS } from 'react-native-permissions';
class App extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<View style={styles.container}>
<Text>Open up App.js to start working on your app!</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
export default App;
这是 app.json 文件:
{
"expo": {
"name": "App1",
"slug": "App1",
"privacy": "public",
"sdkVersion": "36.0.0",
"platforms": [
"ios",
"android",
"web"
],
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true
}
}
}