React Native 世博相机

React Native Expo Camera

React Native expo camera 示例给出错误,如 _Camera is not defined https://docs.expo.io/versions/latest/sdk/camera.html but I see others have gotten it to work here

有没有人有一些关于如何使用相机模块的基本代码?或者调试为什么文档示例不起作用?

我遇到了同样的问题,经过大量研究后,从 v20.I 添加的 Expo Camera 使用的是 v19.0。我是 Expo 的新手,没有意识到它是在 v20 here 中添加的。将 react-native expo 版本升级到 v20 后问题解决。 .basic code for camera in expo is here

编辑 package.json

"react-native": "https://github.com/expo/react-native/archive/sdk-20.0.0.tar.gz",

"expo": "20.0.0-alpha.4",

"react": "16.0.0-alpha.12",

编辑 app.json

"sdkVersion": "20.0.0",
  • 删除项目的 node_modules 目录和 运行 npm install

  • 在 XDE 中重新打开项目并按“重新启动”以清除打包程序缓存