diff options
Diffstat (limited to 'src/screens')
-rw-r--r-- | src/screens/onboarding/InvitationCodeVerification.tsx | 27 | ||||
-rw-r--r-- | src/screens/profile/CaptionScreen.tsx | 10 | ||||
-rw-r--r-- | src/screens/profile/ProfileScreen.tsx | 20 | ||||
-rw-r--r-- | src/screens/profile/SocialMediaTaggs.tsx | 12 |
4 files changed, 41 insertions, 28 deletions
diff --git a/src/screens/onboarding/InvitationCodeVerification.tsx b/src/screens/onboarding/InvitationCodeVerification.tsx index fd5f828b..8a3d5982 100644 --- a/src/screens/onboarding/InvitationCodeVerification.tsx +++ b/src/screens/onboarding/InvitationCodeVerification.tsx @@ -10,7 +10,7 @@ import { LoadingIndicator, } from '../../components'; -import {VERIFY_INVITATION_CODE_ENDPOUNT} from "../../constants" +import {VERIFY_INVITATION_CODE_ENDPOUNT} from '../../constants'; import {Text} from 'react-native-animatable'; import { @@ -53,18 +53,19 @@ const InvitationCodeVerification: React.FC<InvitationCodeVerificationProps> = ({ }); const handleInvitationCodeVerification = async () => { - if(value.length === 6){ - try { - let verifyInviteCodeResponse = await fetch(VERIFY_INVITATION_CODE_ENDPOUNT + value + '/', { - method: 'DELETE', - }); + if (value.length === 6) { + try { + let verifyInviteCodeResponse = await fetch( + VERIFY_INVITATION_CODE_ENDPOUNT + value + '/', + { + method: 'DELETE', + }, + ); if (verifyInviteCodeResponse.status == 200) { navigation.navigate('RegistrationOne'); } else { - Alert.alert( - 'Invalid invitation code 🤔', - ); + Alert.alert('Invalid invitation code 🤔'); } } catch (error) { Alert.alert( @@ -76,9 +77,8 @@ const InvitationCodeVerification: React.FC<InvitationCodeVerificationProps> = ({ description: error, }; } - } - else{ - Alert.alert("The code entered is not valid!"); + } else { + Alert.alert('The code entered is not valid!'); } }; @@ -97,7 +97,8 @@ const InvitationCodeVerification: React.FC<InvitationCodeVerificationProps> = ({ <KeyboardAvoidingView behavior="padding" style={styles.form}> <Text style={styles.formHeader}>Enter the code</Text> <Text style={styles.description}> - Please enter the invitation code provided to you by us / your friend. (Use all caps.) + Please enter the invitation code provided to you by us / your friend. + (Use all caps.) </Text> <CodeField ref={ref} diff --git a/src/screens/profile/CaptionScreen.tsx b/src/screens/profile/CaptionScreen.tsx index e3040509..53c47a6d 100644 --- a/src/screens/profile/CaptionScreen.tsx +++ b/src/screens/profile/CaptionScreen.tsx @@ -42,14 +42,14 @@ const CaptionScreen: React.FC<CaptionScreenProps> = ({route, navigation}) => { setCaption(caption); }; - const checkImageUploadStatus = (statusMap : object) => { - for(let [key, value] of Object.entries(statusMap)){ - if (value != "Success"){ + const checkImageUploadStatus = (statusMap: object) => { + for (let [key, value] of Object.entries(statusMap)) { + if (value != 'Success') { return false; } } return true; - } + }; const handleShare = async () => { try { @@ -68,7 +68,7 @@ const CaptionScreen: React.FC<CaptionScreenProps> = ({route, navigation}) => { }); request.append('moment', title); request.append('user_id', userId); - request.append('captions', JSON.stringify({'image':caption})); + request.append('captions', JSON.stringify({image: caption})); let response = await fetch(MOMENTS_UPLOAD_ENDPOINT, { method: 'POST', headers: { diff --git a/src/screens/profile/ProfileScreen.tsx b/src/screens/profile/ProfileScreen.tsx index cc388ffd..7d11fa2a 100644 --- a/src/screens/profile/ProfileScreen.tsx +++ b/src/screens/profile/ProfileScreen.tsx @@ -2,20 +2,28 @@ import React from 'react'; import {StatusBar} from 'react-native'; import Animated from 'react-native-reanimated'; import {Content, Cover, TabsGradient} from '../../components'; -import {AuthContext} from '../../routes/authentication'; +import {RouteProp} from '@react-navigation/native'; +import {ProfileStackParams} from '../../routes/profile'; /** - * Profile Screen for a user's logged in profile + * Profile Screen for a user's profile * including posts, messaging, and settings */ -const ProfileScreen: React.FC = () => { - const {user} = React.useContext(AuthContext); + +type ProfileScreenRouteProps = RouteProp<ProfileStackParams, 'Profile'>; + +interface ProfileOnboardingProps { + route: ProfileScreenRouteProps; +} + +const ProfileScreen: React.FC<ProfileOnboardingProps> = ({route}) => { + const {isProfileView} = route.params; const y = Animated.useValue(0); return ( <> <StatusBar /> - <Cover {...{y, user}} /> - <Content {...{y, user}} /> + <Cover {...{y, isProfileView}} /> + <Content {...{y, isProfileView}} /> <TabsGradient /> </> ); diff --git a/src/screens/profile/SocialMediaTaggs.tsx b/src/screens/profile/SocialMediaTaggs.tsx index 9e4f2aea..ddbebcea 100644 --- a/src/screens/profile/SocialMediaTaggs.tsx +++ b/src/screens/profile/SocialMediaTaggs.tsx @@ -4,7 +4,7 @@ import {ScrollView, StatusBar, StyleSheet, View} from 'react-native'; import LinearGradient from 'react-native-linear-gradient'; import {AVATAR_GRADIENT} from '../../constants'; import {SocialMediaInfo, TabsGradient, TaggsFeed} from '../../components'; -import {AuthContext, ProfileStackParams} from '../../routes'; +import {AuthContext, ProfileStackParams, ProfileContext} from '../../routes'; import {headerBarHeightWithImage, SCREEN_HEIGHT} from '../../utils'; type SocialMediaTaggsRouteProp = RouteProp< @@ -27,17 +27,21 @@ interface SocialMediaTaggsProps { * + date posted * + dark background */ -const SocialMediaTaggs: React.FC<SocialMediaTaggsProps> = () => { +const SocialMediaTaggs: React.FC<SocialMediaTaggsProps> = ({route}) => { + const {isProfileView} = route.params; + const context = isProfileView + ? React.useContext(ProfileContext) + : React.useContext(AuthContext); const { user, profile: {name}, - } = React.useContext(AuthContext); + } = context; // TODO: We should use the passed-in socialmedia type/handle instead. // Currently don't have an intuitive way of doing so, for now, // just grabbing from user's AuthContext. // const {socialMediaType, socialMediaHandle} = route.params; - const {instaPosts} = React.useContext(AuthContext); + const {instaPosts} = context; const socialMediaType = 'Instagram'; const socialMediaHandle = instaPosts[0].username; |