我正在尝试从子选项卡导航器导航到父堆栈导航器的屏幕。但是 this.props.navigation.navigate 只能导航到孩子的导航道具'
//stack.js
const AppNavigator = createStackNavigator(
{
DetailPage: DetailPage, //Screen A
MainScreen: { . //Screen B
screen: MainScreen,
navigationOptions: {
header: null
}
}
{
initialRouteName: "MainScreen"
}
}
//MainScreen.js
<View style={{ flex: 1 }}>
<TabScreen />
</View>
//TabScreen.js
const TabScreen = createMaterialTopTabNavigator({
Home: {
screen: HomeStack
},
// Videos: { screen: Videos },
Videos: {
screen: Videos
},
Shows: {
screen: AllShows
},
Live: {
screen: Live
}
})'
我想从 (TabNavigator)TabScreen 的主页导航到 (StackNavigator)AppNavigator 的 DetailPage。但是 OnPress 什么都不做。但是,它可以导航到 TabNavigator(子导航器)的不同屏幕。请帮助我如何从子 TabNavigator 导航到父 StackNavigator