React native `戈巴克`在';不要回去
这是我的navigation.js:React native `戈巴克`在';不要回去,react-native,react-navigation,React Native,React Navigation,这是我的navigation.js: export const BottomTabs = createBottomTabNavigator({ 'Specials': { screen:SpecialsScreen }, 'Menus': { screen:MenusScreen }, }); export const Drawer = DrawerNavigator({ Home: { screen: Home, nav
export const BottomTabs = createBottomTabNavigator({
'Specials': {
screen:SpecialsScreen
},
'Menus': {
screen:MenusScreen
},
});
export const Drawer = DrawerNavigator({
Home: { screen: Home, navigationOptions: {drawerLabel:() => null} },
Explore: { screen: BottomTabs },
'Support & Contact': { screen: ContactScreen },
Settings: { screen: Settings, navigationOptions: {drawerLabel:() => null} },
TOU: { screen: TOU, navigationOptions: {drawerLabel:() => 'Terms of Use'} },
Privacy: { screen: Privacy, navigationOptions: {drawerLabel:() => 'Privacy Policy'} },
Disclaimer: { screen: Disclaimer },
});
因此,应用程序启动后,您将看到主页
屏幕:
App.js
render(){
return(<Provider store={store}><Drawer /></Provider>)
}
HomeScreen.js
<TouchableOpacity onPress={() => {
this.props.navigation.navigate('Specials');
}}>
从Specials
中,我点击汉堡图标切换抽屉,进入Support&Contact
,其中有一个后退按钮,我想让我回到上一个屏幕:
ContactScreen.js
<TouchableOpacity onPress={() => {
this.props.navigation.goBack();
}}>
ContactScreen.js
{
this.props.navigation.goBack();
}}>
但这会把我带到
家
,而不是像我想象的那样探索
或特价
。我错过了什么?必须添加堆栈导航器
const AppStack = createStackNavigator({ App: SpecialsScreen, MenusScreen });
const HomeStack = createStackNavigator({ Home });
从Explore中,我点击汉堡包图标来切换我的抽屉,然后转到this.props.navigation.goBack();我不明白你的意图above@SirKoswara我已经重写了这个。你试过使用
goBack(null)
吗?@JoseVf刚刚试过,运气不好。