_signInAsync() {
if (this.state.mobile === '') {
alert('Please provide a valid mobile number');
return false;
}
return axios.get('http://127.0.0.1:8000/api/otp/request/'
+this.state.mobile)
.then((response) => {
console.log(response.data.data.otp);
this.props.navigation.navigate('OtpConfirm');
})
.catch((error) => {
console.log(error);
});
}
我无法导航到axios请求成功的屏幕。请帮助我。
const AppStack = StackNavigator({ Home: HomeScreen, Other: OtherScreen
});
const AuthStack = StackNavigator({ SignIn: SignInScreen, OtpConfirm:
OtpConfirmScreen });
export default SwitchNavigator({
AuthLoading: AuthLoadingScreen,
App: AppStack,
Auth: AuthStack
},
{
initialRouteName: 'AuthLoading'
}
);
上面是根导航文件,我使用SwitchNavigator分隔身份验证屏幕和其他