我正在尝试使用前导航在我的应用程序中实现登录/注销功能:
render() {
return (
<TabNavigation tabBarHeight={56} initialTab="devices">
<TabNavigationItem
id="devices"
renderIcon={isSelected => this._renderIcon('hdd-o', isSelected)}>
<StackNavigation initialRoute="devices" defaultRouteConfig={{
navigationBar: {
backgroundColor: '#B67075',
tintColor: 'white',
},
}}/>
</TabNavigationItem>
<TabNavigationItem
id="rules"
renderIcon={isSelected => this._renderIcon('book', isSelected)}>
<StackNavigation initialRoute="rules" defaultRouteConfig={{
navigationBar: {
backgroundColor: '#B67075',
tintColor: 'white',
},
}}/>
</TabNavigationItem>
<TabNavigationItem
id="settings"
renderIcon={isSelected => this._renderIcon('cog', isSelected)}>
<StackNavigation initialRoute="settings" defaultRouteConfig={{
navigationBar: {
backgroundColor: '#B67075',
tintColor: 'white',
},
}}/>
</TabNavigationItem>
</TabNavigation>
但是,如果我在其中一个 TabNavigationItem 屏幕上尝试注销,则选项卡导航内的页面会注销,而不是整个页面。基本上,我在设置页面(第三个选项卡)上有一个注销按钮,当我注销时,该选项卡会返回登录屏幕,而选项卡栏仍然存在。这是该设置组件中的功能:
logout = () => {
firebase.auth().signOut().then(() => {
this.props.navigator.push(Router.getRoute('goodbye'));
}).catch(function(error) {
// An error happened.
});
}
是否有不同的导航器功能可以从整个选项卡视图导航?是否有一个监听器或我应该添加到父选项卡导航组件的东西?