我正在使用 React Native 和 Expo SDK 41.0.1 构建一个 iOS 应用程序。我的一个组件使用了 expo-camera 库,它在我手机上的 Expo App 和 expo 的 iOS 模拟器上运行良好。但是,当我发布到我的 TestFlight 应用程序时,如果使用 expo-camera 库中的任何方法或对象,应用程序会立即崩溃,即使我只是这样做:
import {Camera} from 'expo-camera';
const test = Camera.Constants.FlashMode.off;
我无法让 Sentry 记录错误。我尝试了一些事情并且能够记录此错误,但由于以下原因无法重新创建它:
Invariant Violation: Tried to register two views with the same name ViewManagerAdapter_ExponentCamera
我在网上读过这个异常通常意味着一个库已经安装了两次。但是,如果我运行“npm ls expo-camera”,则输出仅显示一个实例:
└── expo-camera@11.0.3
我尝试使用“expo install expo-camera”卸载并重新安装。我已删除我的 node_modules 并重新安装。没有任何东西可以修复错误,我无法在本地重现它,因此很难调试。任何意见,将不胜感激。
这是我的 package.json 供参考:
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject",
"test": "jest --watchAll",
"lint": "eslint 'components/**/*.{js,ts,tsx}' --quiet --fix",
"prettier": "prettier --config .prettierrc '**/*.ts' --write"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"@expo/vector-icons": "^12.0.0",
"@react-native-community/masked-view": "0.1.10",
"@react-navigation/bottom-tabs": "5.11.2",
"@react-navigation/native": "~5.8.10",
"@react-navigation/stack": "~5.12.8",
"@types/lodash": "^4.14.170",
"@types/react": "~16.9.35",
"@types/react-native": "~0.63.2",
"@types/uuid": "^8.3.0",
"@typescript-eslint/eslint-plugin": "^4.26.0",
"@typescript-eslint/parser": "^4.26.0",
"atob": "^2.1.2",
"axios": "^0.21.1",
"eslint": "^7.27.0",
"expo": "~41.0.1",
"expo-asset": "~8.3.1",
"expo-asset-utils": "^2.0.0",
"expo-camera": "~11.0.2",
"expo-constants": "~10.1.3",
"expo-font": "~9.1.0",
"expo-image-manipulator": "~9.1.0",
"expo-image-picker": "~10.1.4",
"expo-linking": "~2.2.3",
"expo-media-library": "~12.0.2",
"expo-secure-store": "~10.1.0",
"expo-splash-screen": "~0.10.2",
"expo-status-bar": "~1.0.4",
"expo-web-browser": "~9.1.0",
"lodash": "^4.17.21",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-41.0.0.tar.gz",
"react-native-base64": "^0.2.1",
"react-native-elements": "^3.4.1",
"react-native-gesture-handler": "~1.10.2",
"react-native-linear-gradient": "^2.5.6",
"react-native-reanimated": "~2.1.0",
"react-native-safe-area-context": "3.2.0",
"react-native-screens": "~3.0.0",
"react-native-svg": "^12.1.1",
"react-native-web": "~0.13.12",
"react-native-webview": "^11.6.2",
"sentry-expo": "^3.1.0",
"uuid": "^3.4.0"
},
"devDependencies": {
"@babel/core": "^7.9.0",
"@types/react-native-base64": "^0.1.0",
"@welldone-software/why-did-you-render": "^6.2.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-react": "^7.24.0",
"eslint-plugin-react-hooks": "^4.2.0",
"jest-expo": "~41.0.0",
"prettier": "^2.3.0",
"typescript": "~4.0.0"
},
"private": true
}