Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16750

React Native Alert auto hide and dissapear

$
0
0

I have an issue with Alert in react native.

I'm using alert to show messages to the user. In android, Alert works fine but in iOS Alert will pop up and disappear automatically.

Code :

export const loginUser = (values) => {  return (dispatch) => {    console.log("REDUX THUNK STARTED !");    console.log("GET DATA FROM : ", Helpers.USER_LOGIN);    dispatch(onLoginRequest(true));    fetch(Helpers.USER_LOGIN, {      method: "POST",      headers: {"Content-Type": "application/json",      },      body: JSON.stringify({        email: values.userEmail,        password: values.userPassword,      }),    })      .then((res) => {        dispatch(onLoginRequest(false));        console.log("Response Status from the URL - ", res.status);        console.log("REDUX THUNK COMPLETE !");        //Handle the response accordingly        if (res.status == "200") {          values.navigation.navigate("HomeScreen");          dispatch(onLoginSuccess(true));        } else if (res.status == "400") {          //Invalid credentails          Alert.alert("Error","Please Check Email and Password",            [{ text: "OK", onPress: () => dispatch(onLoginSuccess(false)) }],            { cancelable: false }          );        } else {          errorDialog.globalError();        }      })      .catch((e) => {        console.warn("URL Fetch Error - ", e);        dispatch(onLoginRequest(false));        dispatch(onLoginFailure(true));        console.log("REDUX THUNK ERROR !");        errorDialog.globalError();      });  };};

Viewing all articles
Browse latest Browse all 16750

Trending Articles