Skip to content

Commit

Permalink
Merge pull request redacademy#128 from redacademy/feature-profile
Browse files Browse the repository at this point in the history
Adjust profile field placeholder values
  • Loading branch information
codedavinci authored Sep 21, 2017
2 parents 1a61999 + d542ec3 commit 47445c4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 25 deletions.
20 changes: 10 additions & 10 deletions js/config/helpers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Platform, ImagePickerIOS} from 'react-native';
import { Platform, ImagePickerIOS } from 'react-native';
import RNFetchBlob from 'react-native-fetch-blob'
import firebase from 'firebase';
import { auth, betadb, betaevents, betatalks, betaquestions, betausers, betastorage } from './firebase';
Expand All @@ -7,13 +7,13 @@ const Blob = RNFetchBlob.polyfill.Blob
const fs = RNFetchBlob.fs
window.XMLHttpRequest = RNFetchBlob.polyfill.XMLHttpRequest
window.Blob = Blob

//users
const user = { //input format for initial signup form;
email: 'test@pest.com',
password: 'password',
name: 'Firstname Lastname'
}

//login/logout
export function login(profile) {
return auth.signInWithEmailAndPassword(profile.email, profile.password)
Expand All @@ -40,11 +40,11 @@ export async function signUp(profile) {
//update
function updateEmail(user, email) {
if(email) {
return user.updateEmail(email)
.then(()=>updateEmailField(user.uid, email))
.catch(function (error) {
console.log(error)
});
return user.updateEmail(email)
.then(()=>updateEmailField(user.uid, email))
.catch(function (error) {
console.log(error)
});
} else {
console.log('empty email')
}
Expand All @@ -65,9 +65,9 @@ function updateFullname(user, name) {
function updatePass(user, password) {
if(password) {
user.updatePassword(password)
.catch(function (error) {
console.log(error)
});
.catch(function (error) {
console.log(error)
});
} else {
console.log('empty pass')
}
Expand Down
32 changes: 17 additions & 15 deletions js/scenes/Profile/Profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,41 +37,43 @@ const Profile = ({ updateProfile, user, handleImageUpload, imageUrl, handleBio,
<TextInput
style={styles.inputBig}
onChangeText={(text) => handleBio(text)}
value={bioField || handleBio(user.bio)}
value={bioField}
multiline={true}
maxLength={100}
placeholder="Personal bio"
placeholder={user.bio}
/>
</View>
<Text style={styles.headings}>Things you're working on</Text>
<Text style={styles.headings}>Goal One</Text>
<View style={styles.fieldsContainer}>
<TextInput
style={styles.inputBig}
onChangeText={(text) => handleGoals(text, "goalOne")}
value={goalsField.goalOne || handleGoals(user.goals.goalOne, "goalOne")}
value={goalsField.goalOne}
multiline={true}
maxLength={100}
placeholder="Goal #1"
placeholder={user.goals.goalOne}
/>
</View>
<Text style={styles.headings}>Goal Two</Text>
<View style={styles.fieldsContainer}>
<TextInput
style={styles.inputBig}
onChangeText={(text) => handleGoals(text, "goalTwo")}
value={goalsField.goalTwo || handleGoals(user.goals.goalTwo, "goalTwo")}
value={goalsField.goalTwo}
multiline={true}
maxLength={100}
placeholder="Goal #2"
placeholder={user.goals.goalTwo}
/>
</View>
<Text style={styles.headings}>Goal Three</Text>
<View style={styles.fieldsContainer}>
<TextInput
style={styles.inputBig}
onChangeText={(text) => handleGoals(text, "goalThree")}
value={goalsField.goalThree || handleGoals(user.goals.goalThree, "goalThree")}
value={goalsField.goalThree}
multiline={true}
maxLength={100}
placeholder="Goal #3"
placeholder={user.goals.goalThree}
/>
</View>
<Text style={styles.headings}>Facebook</Text>
Expand All @@ -81,8 +83,8 @@ const Profile = ({ updateProfile, user, handleImageUpload, imageUrl, handleBio,
autoCorrect={false}
autoCapitalize="none"
onChangeText={(text) => handleSocialMedia(text, "facebook")}
value={socialMedia.facebook || handleSocialMedia(user.socialMediaUrls.facebook, "facebook")}
placeholder="Facebook"
value={socialMedia.facebook}
placeholder={user.socialMediaUrls.facebook}
/>
</View>
<Text style={styles.headings}>Twitter</Text>
Expand All @@ -92,8 +94,8 @@ const Profile = ({ updateProfile, user, handleImageUpload, imageUrl, handleBio,
autoCorrect={false}
autoCapitalize="none"
onChangeText={(text) => handleSocialMedia(text, "twitter")}
value={socialMedia.twitter || handleSocialMedia(user.socialMediaUrls.twitter, "twitter")}
placeholder="Twitter"
value={socialMedia.twitter}
placeholder={user.socialMediaUrls.twitter}
/>
</View>
<Text style={styles.headings}>LinkedIn</Text>
Expand All @@ -103,8 +105,8 @@ const Profile = ({ updateProfile, user, handleImageUpload, imageUrl, handleBio,
autoCorrect={false}
autoCapitalize="none"
onChangeText={(text) => handleSocialMedia(text, "linkedIn")}
value={socialMedia.linkedIn || handleSocialMedia(user.socialMediaUrls.linkedIn, "linkedIn")}
placeholder="LinkedIn"
value={socialMedia.linkedIn}
placeholder={user.socialMediaUrls.linkedIn}
/>
</View>
<SurveyButton
Expand Down

0 comments on commit 47445c4

Please sign in to comment.