Some more UI changes for circle profile
This commit is contained in:
@@ -101,7 +101,7 @@ export default Groups;
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
padding: 5,
|
||||
padding: 0,
|
||||
},
|
||||
title: {
|
||||
padding: 10,
|
||||
|
||||
@@ -34,6 +34,7 @@ let Profile = ({ navigation, route }) => {
|
||||
let [profile, setProfile] = useState({});
|
||||
const [showNewPost, setShowNewPost] = useState(false);
|
||||
const [tag, setTag] = useState('');
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
let subscribed = true;
|
||||
@@ -50,6 +51,7 @@ let Profile = ({ navigation, route }) => {
|
||||
await getProfilePosts(route.params.profileid).then(setPosts);
|
||||
console.log('Loaded Cache Profile:' + route.params.profileid);
|
||||
API.getPosts(route.params.profileid).then((data) => {
|
||||
setLoading(false);
|
||||
if(!subscribed) return 0;
|
||||
setPosts(data);
|
||||
storeProfilePosts(route.params.profileid, data);
|
||||
@@ -135,20 +137,21 @@ let Profile = ({ navigation, route }) => {
|
||||
return (
|
||||
<SafeAreaView style={styles.container}>
|
||||
<View>
|
||||
{(Posts.length !== 0 || profile._id) &&
|
||||
{(Posts.length !== 0 || profile._id) ?
|
||||
<FlatList
|
||||
data={Posts}
|
||||
renderItem={renderPost}
|
||||
keyExtractor={item => item.lastUpdated || item._id || item.ceatedAt}
|
||||
ListHeaderComponent={header}
|
||||
refreshing={Posts.length === 0}
|
||||
refreshing={loading}
|
||||
initialNumToRender={3}
|
||||
maxToRenderPerBatch={3}
|
||||
removeClippedSubviews={true}
|
||||
onRefresh={() => {
|
||||
API.getPosts(route.params.profileid).then(setPosts);
|
||||
}}
|
||||
/>
|
||||
/> :
|
||||
<></> //TODO: Add empty profile card here
|
||||
}
|
||||
</View>
|
||||
<StatusBar style="auto" />
|
||||
|
||||
@@ -15,10 +15,12 @@ const Search = () => {
|
||||
|
||||
useEffect(() => {
|
||||
let subscribed = true;
|
||||
API.searchProfiles('').then((data) => {
|
||||
if (subscribed)
|
||||
setProfiles(data.profiles || []);
|
||||
});
|
||||
// Igonred as we are using following
|
||||
//API.searchProfiles('').then((data) => {
|
||||
// if (subscribed && data.profiles){
|
||||
// setProfiles(filteredProfiles);
|
||||
// }
|
||||
//});
|
||||
return () => {
|
||||
subscribed = false;
|
||||
}
|
||||
@@ -29,6 +31,7 @@ const Search = () => {
|
||||
if (queryTimer) clearTimeout(queryTimer);
|
||||
let timerId = setTimeout(() => {
|
||||
API.searchProfiles(query).then((data) => {
|
||||
console.log("DataChange Search view")
|
||||
setProfiles(data.profiles || []);
|
||||
});
|
||||
}, 300);
|
||||
@@ -40,6 +43,7 @@ const Search = () => {
|
||||
const renderFollowing = (({ item }) => {
|
||||
return (<ProfileCardHorizontal profileid={item} />);
|
||||
});
|
||||
const followers = viewer.following.slice().reverse().slice(0, 10);
|
||||
return (
|
||||
<SafeAreaView style={{ flex: 1, backgroundColor: "#edf2f7", }}>
|
||||
<Searchbar
|
||||
@@ -59,10 +63,10 @@ const Search = () => {
|
||||
<FlatList
|
||||
contentContainerStyle={styles.container}
|
||||
numColumns={1}
|
||||
data={viewer.following}
|
||||
data={followers}
|
||||
renderItem={renderFollowing}
|
||||
keyExtractor={item => item}
|
||||
ListHeaderComponent={<Text style={{fontSize:20, padding:10, alignSelf: "center"}}>Current Following</Text>}
|
||||
ListHeaderComponent={<Text style={{fontSize:20, padding:10, alignSelf: "center"}}>Recently Following</Text>}
|
||||
/>
|
||||
}
|
||||
</SafeAreaView>
|
||||
|
||||
Reference in New Issue
Block a user