Wix react-native-navigation更改Tab和推屏 [英] Wix react-native-navigation change Tab and push screen
本文介绍了Wix react-native-navigation更改Tab和推屏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何同时切换标签和推屏?
按下按钮时,
我想切换到另一个标签并按下新屏幕。
有可能吗?
How can I simultaneously switch tab and push screen? When the button is pressed, I would like to switch to another tab and push a new screen. Is it possible?
class Example extends Component {
buttonHandler = () => {
this.props.navigator.switchToTab({
tabIndex: 0
});
this.props.navigator.push({ // actually this navigator's tabIndex is 0
screen: "dc.Examplecreen",
title: "Exampe",
passProps: {
lesson : this.props
}
});
}
}
推荐答案
那里没有任何方法 passProps
与 switchToTab
。我也发现在 react-native-navigation
但没有得到任何解决方案。更改选项卡并使用全局变量进行推送。
There is no any way to passProps
with switchToTab
. also i found in react-native-navigation
but not get any solution. change tab and push using a global variable.
我正在使用 react-native-navigation
版本 1.1.463
更改标签 switchToTab
global.isComeFromBooking = true
this.props.navigator.switchToTab({
tabIndex: 2,
});
索引2上的标签 setOnNavigatorEvent
componentDidMount() {
this.props.navigator.setOnNavigatorEvent((e) => {
if (e.id == 'willAppear' && global.isComeFromBooking) {
this.props.navigator.push({
screen: 'Reservations',
title: 'Bookings',
animated: true,
style: {
backgroundColor: 'black',
},
backButtonTitle: '',
});
global.isComeFromBooking = false
}
});
}
这篇关于Wix react-native-navigation更改Tab和推屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文