我的路由器
import React, {Component} from 'react';
import {NavigationContainer} from '@react-navigation/native';
import {createStackNavigator} from '@react-navigation/stack';
import {createDrawerNavigator} from '@react-navigation/drawer';
import Cart from './Cart';
import Home from './Home';
import About from './About';
import Contact from './Contact';
import Product from './Product';
import Search from './Search';
const Drawer = createDrawerNavigator();
const Stack = createStackNavigator();
const SubPart = () => {
return (
<Stack.Navigator>
<Stack.Screen name="About" component={About} />
<Stack.Screen name="Search" component={Search} />
<Stack.Screen name="Product" component={Product} />
<Stack.Screen name="Contact" component={Contact} />
</Stack.Navigator>
);
};
class DrawerMain extends Component {
render() {
return (
<NavigationContainer>
<Drawer.Navigator>
<Drawer.Screen name="Home" component={Home} />
<Drawer.Screen name="SubPart" component={SubPart} />
<Drawer.Screen name="Cart" component={Cart} />
</Drawer.Navigator>
</NavigationContainer>
);
}
}
export default DrawerMain;
当我单击子部分时,我会得到关于屏幕的信息,然后进入堆栈屏幕中的产品屏幕,如果我进入购物车的抽屉屏幕,然后单击子部件的抽屉项目,那么我会得到产品屏幕而不是关于屏幕。每次单击子专家项目抽屉时,我都可以获得“关于”屏幕吗?