我在使用带有抽屉导航的堆栈导航等反应导航时遇到问题
const Drawerstack = DrawerNavigator({
updatesegregation : { screen: UpdateSegregation },
listoffers : { screen: ListOffers },
mypurse : { screen: MyPurse },
myoffers : { screen: MyOffers },
segregationhistory : { screen: SegregationHistory },
ranking : { screen: Ranking },
updates : { screen: Blogs },
contactus : { screen: ContactUs },
termsandconditions : { screen: TermsAndConditions },
instruction : { screen: Instructions },
profile : { screen: Profile },
segregationtips : { screen: SegregationTips },
faqs : {screen: Faqs },
},{
contentComponent: NavigationDrawer,
})
const Index = StackNavigator({
authcheck : { screen: AuthCheck },
login: { screen: Login },
registration : { screen: Registration },
profileedit : { screen: ProfileEdit },
socialregistration : { screen: SocialRegistration },
forgotpassword : { screen: ForgotPassword },
drawerstack: { screen: Drawerstack },
},
{
headerMode: 'none'
});
export default Index;
根页面是 authcheck,它检查访问令牌并返回用户。
fetch(url.main + 'version' + url.transform, {
method: 'GET',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
}).then((response) => response.json())
.then((responseData) => {
//alert(JSON.stringify(responseData))
if(responseData.version[0].version_code == Version){
AsyncStorage.getItem('User').then((value) => {
//alert(JSON.parse(value));
var tmpValue = JSON.parse(value);
if (tmpValue !== null) {
this.props.navigation.navigate("updatesegregation");
}else{
this.props.navigation.navigate('login');
}
})
}else{
this.PopupDialog.show();
}
})
但是当有访问令牌可用时,它没有显示任何错误,也没有导航到请求的页面。
此导航不会将我从 DrawerNavigator 重定向到我想要的页面...
如果有人知道请帮忙...