aboutsummaryrefslogtreecommitdiff
path: root/src/screens/profile/EditProfile.tsx
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-04-22 14:32:15 -0400
committerGitHub <noreply@github.com>2021-04-22 14:32:15 -0400
commitf0cff95cfa612b295caf68552bc3d29a7fb23a42 (patch)
treedd3df697478a19048cd4bf6d0b499a91c1a93eb3 /src/screens/profile/EditProfile.tsx
parent4e8e1c0d58424e6b63cfb8470fc0a73c0e6b102b (diff)
parent33c172cc31957966b14321520c56816ba044db14 (diff)
Merge pull request #374 from IvanIFChen/hotfix-linting-fixup
[HOTFIX] Linter fixup
Diffstat (limited to 'src/screens/profile/EditProfile.tsx')
-rw-r--r--src/screens/profile/EditProfile.tsx80
1 files changed, 38 insertions, 42 deletions
diff --git a/src/screens/profile/EditProfile.tsx b/src/screens/profile/EditProfile.tsx
index 8b658043..26802e45 100644
--- a/src/screens/profile/EditProfile.tsx
+++ b/src/screens/profile/EditProfile.tsx
@@ -199,12 +199,12 @@ const EditProfile: React.FC<EditProfileProps> = ({route, navigation}) => {
/*
* Handles changes to the website field value and verifies the input by updating state and running a validation function.
*/
- const handleWebsiteUpdate = (website: string) => {
- website = website.trim();
- let isValidWebsite: boolean = websiteRegex.test(website);
+ const handleWebsiteUpdate = (newWebsite: string) => {
+ newWebsite = newWebsite.trim();
+ let isValidWebsite: boolean = websiteRegex.test(newWebsite);
setForm({
...form,
- website,
+ website: newWebsite,
isValidWebsite,
});
};
@@ -212,27 +212,27 @@ const EditProfile: React.FC<EditProfileProps> = ({route, navigation}) => {
/*
* Handles changes to the bio field value and verifies the input by updating state and running a validation function.
*/
- const handleBioUpdate = (bio: string) => {
- let isValidBio: boolean = bioRegex.test(bio);
+ const handleBioUpdate = (newBio: string) => {
+ let isValidBio: boolean = bioRegex.test(newBio);
setForm({
...form,
- bio,
+ bio: newBio,
isValidBio,
});
};
- const handleGenderUpdate = (gender: string) => {
- if (gender === 'custom') {
- setForm({...form, gender});
+ const handleGenderUpdate = (newGender: string) => {
+ if (newGender === 'custom') {
+ setForm({...form, gender: newGender});
setIsCustomGender(true);
- } else if (gender === null) {
+ } else if (newGender === null) {
// not doing anything will make the picker "bounce back"
} else {
setIsCustomGender(false);
let isValidGender: boolean = true;
setForm({
...form,
- gender,
+ gender: newGender,
isValidGender,
});
}
@@ -267,7 +267,7 @@ const EditProfile: React.FC<EditProfileProps> = ({route, navigation}) => {
};
const handleClassYearUpdate = (value: string) => {
- const classYear = Number.parseInt(value);
+ const classYear = parseInt(value, 10);
setForm({
...form,
classYear,
@@ -383,8 +383,8 @@ const EditProfile: React.FC<EditProfileProps> = ({route, navigation}) => {
headerRight: () => (
<Button
title={'Save'}
- buttonStyle={{backgroundColor: 'transparent', marginRight: 15}}
- titleStyle={{fontWeight: 'bold'}}
+ buttonStyle={styles.headerRightButton}
+ titleStyle={styles.boldFont}
onPress={() => {
setLoading(true);
handleSubmit().then(() => setLoading(false));
@@ -409,22 +409,13 @@ const EditProfile: React.FC<EditProfileProps> = ({route, navigation}) => {
alwaysBounceVertical
contentContainerStyle={{paddingBottom: SCREEN_HEIGHT / 15}}>
<StatusBar barStyle="light-content" translucent={false} />
- <View
- style={{
- position: 'relative',
- alignSelf: 'center',
- }}>
+ <View style={styles.relativeCenter}>
<View>
<View style={styles.profile}>
<LargeProfilePic />
<SmallProfilePic />
</View>
- <View
- style={{
- position: 'relative',
- width: 280,
- alignSelf: 'center',
- }}>
+ <View style={styles.relativeCenterWithWidth}>
<TaggInput
accessibilityHint="Enter a website."
accessibilityLabel="Website input field."
@@ -540,7 +531,7 @@ const EditProfile: React.FC<EditProfileProps> = ({route, navigation}) => {
<SocialIcon
social={'TikTok'}
style={styles.icon}
- screenType={ScreenType.Profile}
+ whiteRing={undefined}
/>
<View style={styles.taggInput}>
<TaggInput
@@ -631,20 +622,6 @@ const styles = StyleSheet.create({
width: 110,
borderRadius: 55,
},
- submitBtn: {
- backgroundColor: '#8F01FF',
- justifyContent: 'center',
- alignItems: 'center',
- width: 150,
- height: 40,
- borderRadius: 5,
- marginTop: '5%',
- },
- submitBtnLabel: {
- fontSize: 16,
- fontWeight: '500',
- color: '#fff',
- },
customGenderInput: {
width: '100%',
height: 40,
@@ -666,7 +643,26 @@ const styles = StyleSheet.create({
aspectRatio: 1,
flex: 1,
},
- taggInput: {flex: 6.5, marginLeft: '3%'},
+ taggInput: {
+ flex: 6.5,
+ marginLeft: '3%',
+ },
+ headerRightButton: {
+ backgroundColor: 'transparent',
+ marginRight: 15,
+ },
+ boldFont: {
+ fontWeight: 'bold',
+ },
+ relativeCenter: {
+ position: 'relative',
+ alignSelf: 'center',
+ },
+ relativeCenterWithWidth: {
+ position: 'relative',
+ width: 280,
+ alignSelf: 'center',
+ },
});
export default EditProfile;