问题描述
我正在尝试向我的 React-native expo 应用程序添加一个抽屉。但是运行后,它给了我标题中提到的错误。我觉得好像缺少一些对等依赖项,但是我在这里安装了 react 导航文档中提到的任何内容:https://reactnavigation.org/docs/getting-started#installing-dependencies-into-an-expo-managed-project
import 'react-native-gesture-handler'; // must be very first import
import { StatusBar } from 'expo-status-bar';
import React from 'react';
import { StyleSheet,Text,View,AppRegistry } from 'react-native';
// components
import LandingPage from './src/components/LandingPage';
import Home from './src/components/Home';
import MainMenu from './src/components/headers/MainMenu';
// navigation tools
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import {createDrawerNavigator} from '@react-navigation/drawer';
const Drawer = createDrawerNavigator();
const Stack = createStackNavigator();
export default function App() {
return (
// router page navigation
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen
name='Home'
component={Home}
options={{
headerLeft: (props) => (
<MainMenu />
),headerTitle: (props)=> (
<Text style={{fontSize: 22,marginBottom: 10}}>Home</Text>
)
}}
/>
<Stack.Screen
name='landing'
component={LandingPage}
options={{ headerShown: null,animationTypeForReplace: 'pop' }}
/>
</Stack.Navigator>
<Drawer.Navigator>
<Drawer.Screen name="another" component={Home} />
</Drawer.Navigator>
</NavigationContainer>
);
};
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)