diff options
| author | Shravya Ramesh <37447613+shravyaramesh@users.noreply.github.com> | 2020-11-17 18:06:14 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-17 21:06:14 -0500 |
| commit | 713d169915a82edfcfe4b44622e3dce8c6adaf0c (patch) | |
| tree | 3f0a0a9ef86e80442c4cc5b6b89be24cf1526268 /src/routes | |
| parent | 9b4ba92df514ca8c5c92c4f9279144e2c9d49e36 (diff) | |
[TMA-382] Edit profile screen (#121)
* added more icon
* a less fat icon
* and the actual icon asset
* bottom drawer skeleton done
* removed warning, better code
* a more completed skeleton done
* bottom drawer done!
* Added content container, sent birthday picker props, minor styling
* differenciating defined and undefined birthdate in birthdate, datepicker
* removed restricting width for TaggDropDown
* Added edit profile screen to navigator stack
* Add EditProfile view, refresh profile view on save
* Removes unnecessary import
* Stores gender and birthdate as part of ProfileType
* Added gender, birthdate, isEditProfile to AuthProv
* Conditional view applied for edit profile button
* Includes discarded changes in previous merge- BD
* removed unused icon
* resolved scary warnings
* added icon to drawer
* Small fix
* minor code improvement
* sc
* fixed birthday bug
* custom gender updation fixed
* small change to birthday default value
* missed something
* cleaned up types! Warnings gone!
* fixed another gender picker bug
* fixed gender bug and cleaned up logic
* removed warning, MUCH better code now
Co-authored-by: Ivan Chen <ivan@thetaggid.com>
Co-authored-by: Ashm Walia <ashmwalia@outlook.com>
Diffstat (limited to 'src/routes')
| -rw-r--r-- | src/routes/authentication/AuthProvider.tsx | 13 | ||||
| -rw-r--r-- | src/routes/profile/Profile.tsx | 12 | ||||
| -rw-r--r-- | src/routes/profile/ProfileStack.tsx | 4 |
3 files changed, 28 insertions, 1 deletions
diff --git a/src/routes/authentication/AuthProvider.tsx b/src/routes/authentication/AuthProvider.tsx index 7da47b71..7046d04f 100644 --- a/src/routes/authentication/AuthProvider.tsx +++ b/src/routes/authentication/AuthProvider.tsx @@ -40,6 +40,8 @@ interface AuthContextProps { blockedUsers: ProfilePreviewType[]; blockedUsersNeedUpdate: boolean; updateBlockedUsers: (value: boolean) => void; + isEditedProfile: boolean; + updateIsEditedProfile: (value: boolean) => void; } const NO_USER: UserType = { @@ -51,6 +53,8 @@ const NO_PROFILE: ProfileType = { biography: '', website: '', name: '', + gender: '', + birthday: undefined, }; const NO_SOCIAL_ACCOUNTS: Record<string, SocialAccountType> = { @@ -79,6 +83,8 @@ export const AuthContext = createContext<AuthContextProps>({ blockedUsers: [], blockedUsersNeedUpdate: true, updateBlockedUsers: () => {}, + isEditedProfile: false, + updateIsEditedProfile: () => {}, }); /** @@ -110,6 +116,7 @@ const AuthProvider: React.FC = ({children}) => { const [blockedUsersNeedUpdate, setBlockedUsersNeedUpdate] = useState<boolean>( true, ); + const [isEditedProfile, setIsEditedProfile] = useState<boolean>(false); const {userId} = user; useEffect(() => { @@ -149,7 +156,7 @@ const AuthProvider: React.FC = ({children}) => { } }; loadData(); - }, [userId]); + }, [userId, isEditedProfile]); useEffect(() => { const loadNewMoments = async () => { @@ -245,6 +252,7 @@ const AuthProvider: React.FC = ({children}) => { followersNeedUpdate, blockedUsers, blockedUsersNeedUpdate, + isEditedProfile, login: (id, username) => { setUser({...user, userId: id, username}); }, @@ -274,6 +282,9 @@ const AuthProvider: React.FC = ({children}) => { updateBlockedUsers: (value) => { setBlockedUsersNeedUpdate(value); }, + updateIsEditedProfile: (value: boolean) => { + setIsEditedProfile(value); + }, }}> {children} </AuthContext.Provider> diff --git a/src/routes/profile/Profile.tsx b/src/routes/profile/Profile.tsx index bffa22ce..b6672c85 100644 --- a/src/routes/profile/Profile.tsx +++ b/src/routes/profile/Profile.tsx @@ -7,6 +7,7 @@ import { ProfileScreen, MomentCommentsScreen, FollowersListScreen, + EditProfile, } from '../../screens'; import {ProfileStack, ProfileStackParams} from './ProfileStack'; import {RouteProp} from '@react-navigation/native'; @@ -99,6 +100,17 @@ const Profile: React.FC<ProfileStackProps> = ({route}) => { component={FollowersListScreen} initialParams={{isProfileView: isProfileView}} /> + <ProfileStack.Screen + name="EditProfile" + component={EditProfile} + options={{ + headerShown: true, + headerTitle: 'Edit Profile', + headerTransparent: true, + headerBackTitleVisible: false, + headerTintColor: 'white', + }} + /> </ProfileStack.Navigator> ); }; diff --git a/src/routes/profile/ProfileStack.tsx b/src/routes/profile/ProfileStack.tsx index b1e86214..5590f78a 100644 --- a/src/routes/profile/ProfileStack.tsx +++ b/src/routes/profile/ProfileStack.tsx @@ -33,6 +33,10 @@ export type ProfileStackParams = { isFollowers: boolean; list: ProfilePreviewType[]; }; + EditProfile: { + userId: boolean; + username: ProfilePreviewType[]; + }; }; export const ProfileStack = createStackNavigator<ProfileStackParams>(); |
