screens/Setup.js
/**
   * Wrapper function to pass data in UI to controller classs for setting up new profile
   */
Wrapper function to pass data in UI to controller classs for setting up new profile
Wrapper function to pass data in UI to controller classs for setting up new profile
function handleProfileSetup() {
    if (!invalidInput(age, height, weight) && !invalidUsername(username)) {
      let data = { name: username, age, height, weight, mrt, hobbies, photoIndex };
      for (let i = 0; i < radioButtons.length; i++)
        if (radioButtons[i].selected) {
          data["gender"] = radioButtons[i].label;
          break;
        }
        storeUserProfile(user, data)
        .then(() => console.log("Done"))
        .then(() => login(user, data))
        .then(() => navigation.navigate("App"))
        .catch((error) => console.log(error));
    } else {
      alert("Input error. Please check again.");
    }
  }
function handleProfileSetup ( ) { if ( ! invalidInput ( age , height , weight ) && ! invalidUsername ( username ) ) { let data = { name : username , age , height , weight , mrt , hobbies , photoIndex } ; for ( let i = 0 ; i < radioButtons . length ; i ++ ) if ( radioButtons [ i ] . selected ) { data [ "gender" ] = radioButtons [ i ] . label ; break ; } storeUserProfile ( user , data ) . then ( ( ) => console . log ( "Done" ) ) . then ( ( ) => login ( user , data ) ) . then ( ( ) => navigation . navigate ( "App" ) ) . catch ( ( error ) => console . log ( error ) ) ; } else { alert ( "Input error. Please check again." ) ; } }
Wrapper function to pass data in UI to controller classs for setting up new profile
Wrapper function to pass data in UI to controller classs for setting up new profile