【发布时间】:2020-09-01 15:50:22
【问题描述】:
我刚刚使用 expo 模板创建了一个新应用程序,并且在不更改代码的情况下执行它会引发以下错误
C02SW0WD:Projects user$ expo init testTabApp
? Choose a template:
----- Managed workflow -----
blank a minimal app as clean as an empty canvas
blank (TypeScript) same as blank but with TypeScript configuration
***❯ tabs several example screens and tabs using react-navigation***
----- Bare workflow -----
minimal bare and minimal, just the essentials to get you started
minimal (TypeScript) same as minimal but with TypeScript configuration
作为附加测试,我创建了一个黑色项目,也使用 expo init(空白 -> 一个像空白画布一样干净的最小应用程序),该应用程序按预期工作......然后我添加了底部选项卡导航所需的 npms:
- 纱线添加@react-navigation/native
- 纱线添加@react-navigation/bottom-tabs
- 纱线添加 react-native-screens
- 纱线添加 react-native-safe-area-context
之后我创建了两个空屏幕并修改了 App.js 以使用底部标签导航,如下所示:
import React from 'react';
import { Text, View } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import Chat from './screens/Chat';
import Home from './screens/Home';
const Tab = createBottomTabNavigator();
export default function App() {
return (
<NavigationContainer>
<Tab.Navigator>
<Tab.Screen name="Home" component={Home} />
<Tab.Screen name="Chat" component={Chat} />
</Tab.Navigator>
</NavigationContainer>
);
}
再次,关于“未定义不是函数('...Object.fromEntries...'附近)”的相同错误
有什么想法吗??
【问题讨论】:
标签: react-native expo react-native-navigation