import React, { useState, useEffect } from 'react';
import { Text, View, ScrollView, StyleSheet } from 'react-native';
import { Avatar, Button, Card, Title, Paragraph } from 'react-native-paper';
import API from './../API.js';
import UserName from './UserName.js';
import Media from './Media.js';
import Comment from "./Comment";
import NewComment from './NewComment.js';
let Post = (props) => {
const viewer = props.viewer;
let [showCommentsB, changeshowCommentsB] = useState(false);
let [post, changePost] = useState(props.post);
let toProfileText = post.toProfile && post.toProfile !== post.profileid ?
{">"} : undefined;
let cleanContent = post.content.replace(/@[A-z]+:.+\w/g, '');
const newComentAdded = (commentData) => {
//add to comments
props.post.comments.push(commentData);
changePost(props.post);
console.log(commentData);
};
return (
{toProfileText}
{cleanContent}
{showCommentsB && }
{
showCommentsB &&
(
post.comments.map((comment, i) => {
return
})
)
}
);
}
export default Post;
const styles = StyleSheet.create({
userName: {
fontSize: 14,
fontWeight: 'bold',
marginBottom: 5,
fontSize: 18,
},
card: {
margin: 8,
backgroundColor: "#FFFFFF"
},
comment:{
margin: 8,
marginTop: 0,
padding: 8
}
});