From 9da19cdcb6c7596d60afde6d0d559f06a24a0627 Mon Sep 17 00:00:00 2001 From: George Rusu <56009869+grusu6928@users.noreply.github.com> Date: Sun, 25 Oct 2020 15:21:38 -0700 Subject: [TMA-237] Added modal for user registration and redirect (#61) * move async-storage * removed lock files * added lock files to gitignore * added the wrong file to gitignore * added modal for user registration and redirect * api call to get list of linked socials for each user to display appropriate icon * fixed indentation and linting * refactored modal and browser sign-in * now dynamically adding linked and unlinked taggs, added a bunch of TODOs for tomorrow * added svg icons * done? finished taggs bar UI and all the navigations including modal * fixed some bugs and added more TODOs * fixed some bugs and refactored posts fetching logic * fixed taggs bar bug * done, it will update everything correctly * added comments * added tiktok Co-authored-by: hsalhab Co-authored-by: george Co-authored-by: Ivan Chen --- src/screens/profile/SocialMediaTaggs.tsx | 33 ++++++++++---------------------- 1 file changed, 10 insertions(+), 23 deletions(-) (limited to 'src/screens') diff --git a/src/screens/profile/SocialMediaTaggs.tsx b/src/screens/profile/SocialMediaTaggs.tsx index 0ac6d1ef..2a319326 100644 --- a/src/screens/profile/SocialMediaTaggs.tsx +++ b/src/screens/profile/SocialMediaTaggs.tsx @@ -1,17 +1,18 @@ import {RouteProp} from '@react-navigation/native'; -import React from 'react'; -import {Alert, ScrollView, StatusBar, StyleSheet, View} from 'react-native'; +import React, {useEffect, useState} from 'react'; +import {ScrollView, StatusBar, StyleSheet, View} from 'react-native'; import LinearGradient from 'react-native-linear-gradient'; -import {AVATAR_GRADIENT} from '../../constants'; import { SocialMediaInfo, TabsGradient, TaggPost, TwitterTaggPost, } from '../../components'; -import {AuthContext, ProfileStackParams, ProfileContext} from '../../routes'; +import {AVATAR_GRADIENT} from '../../constants'; +import {AuthContext, ProfileContext, ProfileStackParams} from '../../routes'; +import {loadSocialPosts} from '../../services'; +import {SimplePostType, SocialAccountType, TwitterPostType} from '../../types'; import {headerBarHeightWithImage, SCREEN_HEIGHT} from '../../utils'; -import {SimplePostType, TwitterPostType} from '../../types'; type SocialMediaTaggsRouteProp = RouteProp< ProfileStackParams, @@ -22,17 +23,6 @@ interface SocialMediaTaggsProps { route: SocialMediaTaggsRouteProp; } -/** - * Social media taggs screen for a user's social media - * includes: - * + tagg profile pic - * + username from social media - * + post - * + caption - * + sharebutton + number of shares - * + date posted - * + dark background - */ const SocialMediaTaggs: React.FC = ({route}) => { const {socialMediaType, isProfileView} = route.params; const context = isProfileView @@ -42,11 +32,8 @@ const SocialMediaTaggs: React.FC = ({route}) => { profile: {name}, socialAccounts, } = context; - - - const handle = socialAccounts[socialMediaType].handle; - const posts = socialAccounts[socialMediaType].posts || []; const headerHeight = headerBarHeightWithImage(); + let accountData = socialAccounts[socialMediaType]; return ( = ({route}) => { - {(posts as Array< + {(accountData.posts as Array< SimplePostType | TwitterPostType >).map((post, index) => socialMediaType === 'Twitter' ? ( ) : ( -- cgit v1.2.3-70-g09d2