我的项目中有这个代码结构 -
const HomeScreenRouter = DrawerNavigator(
{
AppTabNavigator: { screen: AppTabNavigator },
LogOutScreen: { screen: LogOutScreen }
},
{
contentComponent: props => <SideBar {...props} />,
drawerWidth: Dimensions.get('window').width-30,
drawerPosition: "right",
}
);
const MenuImage = ({navigation}) => {
if(!navigation.state.isDrawerOpen){
return <Image source={require('../images/menu-button.png')}/>
}else{
return <Image source={require('../images/left-arrow.png')}/>
}
}
const AppStackNavigator = createStackNavigator({
DrawerNavigator:{
screen: HomeScreenRouter
},
},{
navigationOptions: ({ navigation }) => ({
headerRight:
<TouchableOpacity onPress={() => {navigation.dispatch(DrawerActions.toggleDrawer())} }>
<MenuImage style="styles.bar" navigation={navigation}/>
</TouchableOpacity>,
headerStyle: {
backgroundColor: '#333',
},
headerTintColor: '#fff',
headerTitleStyle: {
fontWeight: 'bold',
},
})
});
export default AppStackNavigator;
在每个选项卡屏幕中,我都想要公共侧边菜单。我在上面做了这样的事情。但我的问题是,当我导航到选项卡详细信息屏幕(通过单击选项卡屏幕内的按钮)时,后退按钮可见嵌套堆栈。但不是这个,我想要父级中的后退按钮(通用标题/菜单)。请让我知道如何实现这一目标。