React 本机导航“类型错误:无法将未定义的值转换为对象”

问题描述 投票:0回答:0

我正在尝试使用 React Native Navigation 创建抽屉,但出现错误 “类型错误:无法将未定义的值转换为对象”。 我一直没能找到问题的确切来源。

App.js




import { NavigationContainer } from '@react-navigation/native'
import { createDrawerNavigator } from '@react-navigation/drawer';

import Home from './src/screens/home';

const Drawer = createDrawerNavigator();

const App = () => {
  return (
    <NavigationContainer>
      <Drawer.Navigator>
        <Drawer.Screen name="Home" component={Home} />
      </Drawer.Navigator>
    </NavigationContainer>
  );
}
export default App;



home.js




import { View, Text } from 'react-native';

const Home = () => {
  return(
    <View>
      <Text>Home</Text>
    </View>
  )
};

export default Home;



error image

我删除并重新安装了软件包。我删除了应用程序并重新创建了它,但我无法解决问题

react-native react-native-navigation
© www.soinside.com 2019 - 2024. All rights reserved.