react-native - StackNavigator 中的 TabNavigator 并且不会推送新页面
问题描述
反应导航 1.x
使用Redux
我的堆栈导航器:
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 中做一些其他的事情,我应该怎么做,让按钮工作?
解决方案
推荐阅读
- javascript - 如何在Javascript中组合多个字典?
- python - python更好的方法来翻转键和值
- observablehq - 可观察的编辑器功能
- python - 在 Seaborn 散点图上标准化对象
- javascript - 使用 webrtc scaledrone 不显示远程视频
- python - 如何在时间序列分类中结合 LSTM 和 CNN
- python - 使用python在给定的相对路径创建文件
- progressive-web-apps - PWA 和 FCM 订阅群组
- c - 如何通过输入避免负数,或者如果用户输入负数程序给出错误结果?
- javascript - reactjs中如何更新挂载状态