Sunday, August 29, 2021

how to make email validation in react native

   const emailValidate = text => {
    console.log(text);
    let reg = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w\w+)+$/;
    if (reg.test(text) === false) {
      Alert.alert('', 'format email salah');
    } else {
      Alert.alert('', 'Email is Correct');
    }
  };

No comments:

Post a Comment