Profile Cache and Profile Header Started

This commit is contained in:
aeroreyna
2022-03-16 21:47:56 -07:00
parent 521ffb19ee
commit dc3079328e
7 changed files with 149 additions and 40 deletions

View File

@@ -1,5 +1,6 @@
import React, { useState, useEffect } from 'react';
import { Text, ScrollView, FlatList, StyleSheet, View } from 'react-native';
import { Text, ScrollView, FlatList, StyleSheet, View, Linking } from 'react-native';
import Hyperlink from 'react-native-hyperlink'
import { Avatar, Button, Card, Title, Chip } from 'react-native-paper';
import API from './../API.js';
import UserName from './UserName.js';
@@ -8,7 +9,6 @@ import Comment from "./Comment";
import NewComment from './NewComment.js';
import Moment from 'moment';
let Post = (props) => {
const viewer = props.viewer;
let [showCommentsB, changeshowCommentsB] = useState(false);
@@ -18,6 +18,7 @@ let Post = (props) => {
let toProfileText = post.toProfile && post.toProfile !== post.profileid ?
<Text> {">"} <UserName profileid={post.toProfile} /></Text> : undefined;
let cleanContent = post.content.replace(/@[A-z]+:.+\w/g, '');
//cleanContent = convertLinks(cleanContent);
const newComentAdded = (commentData) => {
let newPostObj = { ...post };
newPostObj.comments.push(commentData);
@@ -54,23 +55,25 @@ let Post = (props) => {
return (
<Card style={styles.card}>
<Card.Content>
{!post.nonOrganicType ?
<View>
<Text style={styles.userName}>
<UserName profileid={post.profileid} />
{toProfileText}
<Text style={{ fontWeight: 'normal', fontSize: 12 }}>
{" " + Moment(post.createdAt).fromNow()}
<Hyperlink linkDefault={ true }>
{!post.nonOrganicType ?
<View>
<Text style={styles.userName}>
<UserName profileid={post.profileid} />
{toProfileText}
<Text style={{ fontWeight: 'normal', fontSize: 12 }}>
{" " + Moment(post.createdAt).fromNow()}
</Text>
</Text>
</Text>
<Text style={{ fontSize: 18 }}>{cleanContent}</Text>
<Media content={post.content} />
</View> :
<View>
<Chip icon="new-releases" style={{ width: 100 }} >News</Chip>
<Text style={{ fontSize: 18 }}>{cleanContent}</Text>
</View>
}
<Text style={{ fontSize: 18 }}>{cleanContent}</Text>
<Media content={post.content} />
</View> :
<View>
<Chip icon="new-releases" style={{ width: 100 }} >News</Chip>
<Text style={{ fontSize: 18 }}>{cleanContent}</Text>
</View>
}
</Hyperlink>
</Card.Content>
<Card.Actions style={{ flexDirection: "row", flow: 4, justifyContent: 'space-evenly', fontSize: 18 }}>
<Button