diff options
Diffstat (limited to 'src/screens/profile/EditProfile.tsx')
-rw-r--r-- | src/screens/profile/EditProfile.tsx | 59 |
1 files changed, 31 insertions, 28 deletions
diff --git a/src/screens/profile/EditProfile.tsx b/src/screens/profile/EditProfile.tsx index 8afaeb6d..de950923 100644 --- a/src/screens/profile/EditProfile.tsx +++ b/src/screens/profile/EditProfile.tsx @@ -1,52 +1,48 @@ -import React, {Fragment, useCallback, useEffect, useState} from 'react'; import {RouteProp} from '@react-navigation/native'; import {StackNavigationProp} from '@react-navigation/stack'; +import React, {Fragment, useCallback, useEffect, useState} from 'react'; import { - Text, + Alert, + Image, + Keyboard, + KeyboardAvoidingView, + Platform, + SafeAreaView, StatusBar, StyleSheet, - Image, + Text, TouchableOpacity, - Alert, View, - SafeAreaView, - KeyboardAvoidingView, - Platform, - Keyboard, } from 'react-native'; import {Button} from 'react-native-elements'; +import ImagePicker from 'react-native-image-crop-picker'; +import Animated from 'react-native-reanimated'; +import {useDispatch, useSelector} from 'react-redux'; import { Background, + SocialIcon, + TabsGradient, TaggBigInput, - TaggInput, TaggDropDown, - TabsGradient, - SocialIcon, + TaggInput, } from '../../components'; -import ImagePicker from 'react-native-image-crop-picker'; +import TaggLoadingIndicator from '../../components/common/TaggLoadingIndicator'; import { - EDIT_PROFILE_ENDPOINT, - websiteRegex, bioRegex, - genderRegex, CLASS_YEAR_LIST, + genderRegex, + websiteRegex, } from '../../constants'; -import AsyncStorage from '@react-native-community/async-storage'; -import {MainStackParams} from '../../routes'; -import Animated from 'react-native-reanimated'; -import {HeaderHeight, SCREEN_HEIGHT} from '../../utils'; -import {RootState} from '../../store/rootReducer'; -import {useDispatch, useSelector} from 'react-redux'; -import {loadUserData} from '../../store/actions'; -import {BackgroundGradientType, ScreenType} from '../../types'; import { - ERROR_DOUBLE_CHECK_CONNECTION, - ERROR_SOMETHING_WENT_WRONG_REFRESH, ERROR_UPLOAD_LARGE_PROFILE_PIC, ERROR_UPLOAD_SMALL_PROFILE_PIC, } from '../../constants/strings'; -import TaggLoadingIndicator from '../../components/common/TaggLoadingIndicator'; +import {MainStackParams} from '../../routes'; import {patchEditProfile} from '../../services'; +import {loadUserData, resetHeaderAndProfileImage} from '../../store/actions'; +import {RootState} from '../../store/rootReducer'; +import {BackgroundGradientType, ScreenType} from '../../types'; +import {HeaderHeight, SCREEN_HEIGHT} from '../../utils'; type EditProfileNavigationProp = StackNavigationProp< MainStackParams, @@ -78,6 +74,7 @@ const EditProfile: React.FC<EditProfileProps> = ({route, navigation}) => { useEffect(() => { if (needsUpdate) { + dispatch(resetHeaderAndProfileImage()); dispatch(loadUserData({userId, username})); } }, [dispatch, needsUpdate, userId, username]); @@ -120,7 +117,10 @@ const EditProfile: React.FC<EditProfileProps> = ({route, navigation}) => { onPress={goToGalleryLargePic} style={styles.largeProfileUploader}> {form.largePic ? ( - <Image source={{uri: form.largePic}} style={styles.largeProfilePic} /> + <Image + source={{uri: form.largePic, cache: 'reload'}} + style={styles.largeProfilePic} + /> ) : ( <Text style={styles.largeProfileText}>ADD HEADER IMAGE</Text> )} @@ -137,7 +137,10 @@ const EditProfile: React.FC<EditProfileProps> = ({route, navigation}) => { onPress={goToGallerySmallPic} style={styles.smallProfileUploader}> {form.smallPic ? ( - <Image source={{uri: form.smallPic}} style={styles.smallProfilePic} /> + <Image + source={{uri: form.smallPic, cache: 'reload'}} + style={styles.smallProfilePic} + /> ) : ( <Text style={styles.smallProfileText}>ADD PROFILE PICTURE</Text> )} |