const Stylelist = StackNavigator({
Login: {
screen: LoginScreen,
navigationOptions: ({ navigation }) => ({
header: null,
}),
},
Register: {
screen: RegisterScreen,
navigationOptions: ({ navigation }) => ({
header: null,
}),
},
Home: {
screen: HomeScreen,
navigationOptions: ({ navigation }) => ({
title: 'Home',
}),
},
Profile: {
screen: TabNavigator({
Profile: {
screen: ProfileScreen,
navigationOptions: ({ navigation }) => ({
title: 'Profile',
}),
},
Friends: {
screen: FriendsScreen,
navigationOptions: ({ navigation }) => ({
title: 'My Friends',
}),
},
}),
navigationOptions: ({ navigation }) => ({
title: 'Home',
}),
},
ProfileDetail: {
screen: ProfileDetailScreen,
navigationOptions: ({ navigation }) => ({
title: 'Profile Detail',
}),
},
});
如果我想从ProfileScreen导航到ProfileDetailScreen,该怎么办?可以说我要浏览到ProfileDetailScreen内的ProfileScreen中有touchableOpacity
谢谢
更新:我设法在TabNavigator内的headerNavigator中使用了TabNavigator内的StackNavigator,而在TabNavigator内的StackNavigator上没有headerMode,第一次使用时感觉是一样的,但是如果从ProfileDetailScreen返回,它将返回到HomeScreen(因为后退按钮首先来自StackNavigator)行)
答案 0 :(得分:0)
您可以这样导航到ProfileScreen:this.props.navigation.navigate(“ Profile”)。 “配置文件”是StackNavigator页面定义的关键。详细信息here
我也建议使用最新的react navigation (v2)