我試圖用我的應用程序實現登錄/註銷功能,使用前導航:陣營與標籤本地導航註銷功能
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.
});
}
是否有不同的導航器功能從整個選項卡視圖導航?有沒有一個監聽器或我應該添加到父級選項卡導航組件的東西?