在axios上请求成功的本机导航

时间:2018-04-20 09:54:10

标签: react-native axios react-navigation

_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分隔身份验证屏幕和其他

0 个答案:

没有答案