StackNavigator 出错:元素类型无效。得到:未定义

Error with StackNavigator: Element type is invalid. Got: undefined

我试图在我的代码中找到一个错误,但经过这么多时间我感到绝望。你能帮帮我吗?

import React, {useState, useRef, useEffect} from 'react';
import SickList from './pages/SickList'
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';


const App = () => {

const Stack = createStackNavigator();

const Menu = () => {
  return(
<Stack.Navigator>
<Stack.Screen name="Home" component={SickList} />
</Stack.Navigator>)
}

return (
<NavigationContainer>
  <Menu />
</NavigationContainer> 
)

}

export default App;

我不确定这是否导致了您的问题,但您在最后一行之前缺少右大括号 'export default App'

编辑:您可能还需要用大括号将 SickList 导入包起来。

好吧,在尝试找出原因几个小时后,我尝试更改 package.json:

我改成 "react-native": "~0.63.4", "@react-navigation/stack": "^5.14.4", 成功了。