screens/SignUp.js
/**
   * Prints different error messages based on user's input
   */
Prints different error messages based on user's input
Prints different error messages based on user ' s input
function handleSignUp() {
    setOpacity(new Animated.Value(1))
    setErrorMessage("")
    if(!emailValid(email)){
      setErrorMessage("Invalid email address!")
      setSignUpError(true)
    }
    else if(password != confirmPassword){
      setErrorMessage("Passwords not the same, please input again!")
      setSignUpError(true)
    }
    else if(!passwordValid(password)){
      setErrorMessage("Password is invalid!")
      setSignUpError(true)
    }
    else if(!checkedPrivacyPolicy){
      setErrorMessage("Please read the privacy policy!")
      setSignUpError(true)
    }
    else
    {
      userEmailSignup(email, password)
      .then((msg) => {
        if(msg.signUpError) {
          setSignUpError(true)
          setErrorCode(msg.signUpErrorCode)
          translateErrorCodeToMessage()
        }
        else {
          setSignUpError(false)
          login(msg.uid, null) 
          navigation.navigate('Setup')
        }
      })
    }
  }
function handleSignUp ( ) { setOpacity ( new Animated . Value ( 1 ) ) setErrorMessage ( "" ) if ( ! emailValid ( email ) ) { setErrorMessage ( "Invalid email address!" ) setSignUpError ( true ) } else if ( password != confirmPassword ) { setErrorMessage ( "Passwords not the same, please input again!" ) setSignUpError ( true ) } else if ( ! passwordValid ( password ) ) { setErrorMessage ( "Password is invalid!" ) setSignUpError ( true ) } else if ( ! checkedPrivacyPolicy ) { setErrorMessage ( "Please read the privacy policy!" ) setSignUpError ( true ) } else { userEmailSignup ( email , password ) . then ( ( msg ) => { if ( msg . signUpError ) { setSignUpError ( true ) setErrorCode ( msg . signUpErrorCode ) translateErrorCodeToMessage ( ) } else { setSignUpError ( false ) login ( msg . uid , null ) navigation . navigate ( 'Setup' ) } } ) } }
Prints different error messages based on user's input
Prints different error messages based on user ' s input
//no profile set yet