1 回答
TA贡献1785条经验 获得超4个赞
尝试这样做
应用程序.js
// ./App.js
import React from "react";
import { NavigationContainer } from "@react-navigation/native";
import DrawerNavigator from "./navigation/DrawerNavigator";
const App = () => {
return (
<NavigationContainer>
<DrawerNavigator />
</NavigationContainer>
);
};
export default App;
DrawerNavigator.js
// ./navigation/DrawerNavigator.js
import React from "react";
import { createStackNavigator } from "@react-navigation/stack";
import { createDrawerNavigator } from "@react-navigation/drawer";
import Contact from "../screens/Contact";
const Stack = createStackNavigator();
const Drawer = createDrawerNavigator();
const screenOptionStyle = {
headerStyle: {
backgroundColor: "#9AC4F8",
},
headerTintColor: "white",
headerBackTitle: "Back",
};
const ContactStackNavigator = () => {
return (
<Stack.Navigator screenOptions={screenOptionStyle}>
<Stack.Screen name="Contact" component={Contact} />
</Stack.Navigator>
);
};
const DrawerNavigator = () => {
return (
<Drawer.Navigator>
<Drawer.Screen name="Contact" component={ContactStackNavigator} />
</Drawer.Navigator>
);
};
export default DrawerNavigator;
添加回答
举报