【发布时间】:2020-01-31 02:43:50
【问题描述】:
我正在使用expo 来管理我的 React Native 应用程序。当我想在我的 Android 设备上加载它时,我正在使用他们来自 Play Store 的应用程序。直到今天早些时候(01.10),当我的 Android 设备上的客户端应用程序从 Play 商店自动更新时,一切都进行得很顺利。
出了什么问题?
问题是我的代码库使用的是 Expo SDK 32.0,但最新的 Android 客户端应用程序至少需要 33.0 版本的 Expo SDK。
我所做的是遵循本指南:https://docs.expo.io/versions/latest/workflow/upgrading-expo-sdk-walkthrough/#sdk-33
一切都很顺利......但不是真的。我的一些包裹遇到了一些严重的问题,事情变得一团糟。
那么,我决定下一步做什么?
本周我有一个非常重要的演示,我没有时间调查集成问题 首先,我将我的代码库恢复到原来的样子(Expo SDK 32.0),然后我决定从我的客户端应用程序中删除Android 设备并通过下载此 APK 安装旧版本:https://apkpure.com/expo/host.exp.exponent/download/103-APK
现在,我可以在设备上加载应用程序,但我遇到了与导航相关的非常奇怪的错误:
TypeError: TypeError: undefined is not an object (evaluating 'theme.label')
This error is located at:
in HeaderTitle (at Header.tsx:220)
in RCTView (at View.js:44)
in AnimatedComponent (at Header.tsx:531)
in RCTView (at View.js:44)
in RCTView (at View.js:44)
in RCTView (at View.js:44)
in AnimatedComponent (at react-native-safe-area-view/index.js:163)
in SafeView (at withOrientation.js:54)
in withOrientation (at Header.tsx:722)
in RCTView (at View.js:44)
in AnimatedComponent (at Header.tsx:714)
in Header (at withOrientation.js:30)
in withOrientation (at StackViewLayout.tsx:227)
in RCTView (at View.js:44)
in RCTView (at View.js:44)
in AnimatedComponent (at StackViewCard.tsx:106)
in RCTView (at View.js:44)
in AnimatedComponent (at screens.native.js:59)
in Screen (at StackViewCard.tsx:93)
in Card (at createPointerEventsContainer.tsx:95)
in Container (at StackViewLayout.tsx:985)
in RCTView (at View.js:44)
in ScreenContainer (at StackViewLayout.tsx:394)
in RCTView (at View.js:44)
in AnimatedComponent (at StackViewLayout.tsx:384)
in Handler (at StackViewLayout.tsx:377)
in StackViewLayout (at withOrientation.js:30)
in withOrientation (at StackView.tsx:104)
in RCTView (at View.js:44)
in Transitioner (at StackView.tsx:41)
in StackView (at createNavigator.js:80)
in Navigator (at createKeyboardAwareNavigator.js:12)
in KeyboardAwareNavigator (at createAppContainer.js:430)
in NavigationContainer (at App.js:97)
in App (at withExpoRoot.js:22)
in RootErrorBoundary (at withExpoRoot.js:21)
in ExpoRootComponent (at renderApplication.js:34)
in RCTView (at View.js:44)
in RCTView (at View.js:44)
in AppContainer (at renderApplication.js:33)
This error is located at:
in NavigationContainer (at App.js:97)
in App (at withExpoRoot.js:22)
in RootErrorBoundary (at withExpoRoot.js:21)
in ExpoRootComponent (at renderApplication.js:34)
in RCTView (at View.js:44)
in RCTView (at View.js:44)
in AppContainer (at renderApplication.js:33)
我实现导航的方式如下:
import { createStackNavigator, createAppContainer } from 'react-navigation';
// .. other imports
const StackNavigator = createStackNavigator({
// screen definitions
});
export default createAppContainer(StackNavigator);
我真的不明白这个错误来自哪里以及如何解决它。
更多信息:
- react-native-cli: 2.0.1
- 反应原生:0.57.1
- 世博会:2.6.14
- 世博会skd:32.0
我也会分享我的package.json:
{
...
"dependencies": {
"expo": "^32.0.0",
"firebase": "^5.8.0",
"react": "16.5.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",
"react-native-autocomplete-input": "^3.6.0",
"react-native-check-box": "^2.1.7",
"react-native-modal-datetime-picker": "^7.4.2",
"react-navigation": "^3.0.9"
},
"devDependencies": {
"babel-preset-expo": "^5.0.0"
},
...
}
当然还有 app.json:
{
"expo": {
"name": "qr-scanner",
"slug": "qr-scanner",
"privacy": "public",
"sdkVersion": "32.0.0",
"platforms": [
"ios",
"android"
],
"version": "1.0.0",
"orientation": "landscape",
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true
},
...
}
}
在我在设备上选择了一个应该更改屏幕的选项后立即发生错误。然后涉及到导航,我收到了这个错误。
【问题讨论】:
-
您使用的是锁定文件吗?似乎这里有不匹配的 react-navigation 包版本。尝试显式安装
react-navigation@3.13.0 -
@brentvatne 这样做后我现在收到此错误:无法从“node_modules\react-native-gesture-handler\index.js”解析“./touchables”
-
@brentvatne 而且,当我在我的项目文件夹中执行
npm list react-native-gesture-handler时,我得到react-native-gesture-handler@1.0.12 -
您共享的零食位于 sdk34 上,从 sdk34 开始,开发人员需要显式安装 react-native-gesture-handler 等依赖项,而不是依赖 expo 包安装它们。如果您可以在 github 上分享您项目的链接,我可以提供更多帮助
标签: react-native react-navigation expo