From 88fb33d1fe1cd0785e4a92cb3c20d0fafb2da54d Mon Sep 17 00:00:00 2001
From: Ashm Walia <40498934+ashmgarv@users.noreply.github.com>
Date: Mon, 19 Oct 2020 17:14:37 -0700
Subject: Merged changes to make sure moments view and search work (#62)

---
 src/components/profile/Content.tsx | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

(limited to 'src/components/profile/Content.tsx')

diff --git a/src/components/profile/Content.tsx b/src/components/profile/Content.tsx
index d52696a7..0bf66dc7 100644
--- a/src/components/profile/Content.tsx
+++ b/src/components/profile/Content.tsx
@@ -1,10 +1,9 @@
 import AsyncStorage from '@react-native-community/async-storage';
 import React, {useCallback, useEffect, useState} from 'react';
 import {Alert, LayoutChangeEvent, StyleSheet, View} from 'react-native';
-<!-- import {Text} from 'react-native-animatable'; -->
 import Animated from 'react-native-reanimated';
-import {AuthContext} from '../../routes/authentication';
-import {MomentType, UserType} from 'src/types';
+import {AuthContext, ProfileContext} from '../../routes/';
+import {MomentType} from 'src/types';
 import {defaultMoments, MOMENTS_ENDPOINT} from '../../constants';
 import {SCREEN_HEIGHT} from '../../utils';
 import TaggsBar from '../taggs/TaggsBar';
@@ -20,8 +19,9 @@ interface ContentProps {
 
 const Content: React.FC<ContentProps> = ({y, isProfileView}) => {
   const [profileBodyHeight, setProfileBodyHeight] = useState(0);
-  const {newMomentsAvailable, updateMoments} = React.useContext(AuthContext);
-
+  const {newMomentsAvailable, updateMoments, user} = isProfileView
+    ? React.useContext(ProfileContext)
+    : React.useContext(AuthContext);
   const [imagesList, setImagesList] = useState<MomentType[]>([]);
   const [imagesMap, setImagesMap] = useState<Map<string, MomentType[]>>(
     new Map(),
@@ -68,10 +68,10 @@ const Content: React.FC<ContentProps> = ({y, isProfileView}) => {
           setImagesList(data);
           updateMoments(!newMomentsAvailable);
         } else {
-          Alert.alert('Could not load moments!');
+          console.log('Could not load moments!');
         }
       } catch (err) {
-        Alert.alert('Could not load moments!');
+        console.log(err);
       }
     };
 
@@ -91,19 +91,18 @@ const Content: React.FC<ContentProps> = ({y, isProfileView}) => {
       <ProfileCutout>
         <ProfileHeader {...{isProfileView}} />
       </ProfileCutout>
-      <ProfileBody {...{onLayout}} />
-      <TaggsBar {...{y, profileBodyHeight}} />
       <ProfileBody {...{onLayout, isProfileView}} />
       <TaggsBar {...{y, profileBodyHeight, isProfileView}} />
-      {!isProfileView ? (
-        <View style={styles.momentsContainer}>
+      <View style={styles.momentsContainer}>
         {defaultMoments.map((title, index) => (
-          <Moment key={index} title={title} images={imagesMap.get(title)} />
+          <Moment
+            key={index}
+            title={title}
+            images={imagesMap.get(title)}
+            isProfileView={isProfileView}
+          />
         ))}
       </View>
-      ) : (
-        <React.Fragment />
-      )}
     </Animated.ScrollView>
   );
 };
-- 
cgit v1.2.3-70-g09d2

