反应导航 1.x
与 Redux
我的StackNavigator:
export const MyAppStackNavigator = StackNavigator({
......
}, {
initialRouteName: "TabBase",
navigationOptions: ({navigation, screenProps}) => {
},
transitionConfig: () => ({
screenInterpolator: CardStackStyleInterpolator.forHorizontal
})
});
和我的TabNavigator(AppTabNavigator):
const AppTabNavigator = TabNavigator(
{
Page1: {
screen: Page1,
},
},
{}
)
export default class TabBase extends Component {
render() {
return (
<View styles={{
flex: 1
}} >
<AppTabNavigator/>
</View>
)
}
}
在 Page1 中的一个按钮onPress会推送一个新页面
this.props.navigation.navigate("Page2");
但这不起作用。
如果 MyAppStackNavigator 设置了initialRouteName: "AppTabNavigator"
this.props.navigation.navigate("Page2");
正在工作。
但是我需要在TabBase中做其他事情,我应该怎么做,让按钮正常工作?