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"; let Post = ({ post, viewer }) => { let [showCommentsB, changeshowCommentsB] = useState(false); let toProfileText = post.toProfile && post.toProfile !== post.profileid ? {">"} : undefined; let cleanContent = post.content.replace(/@[A-z]+:.+\w/g, ''); return ( {toProfileText} {cleanContent} { showCommentsB && post.comments.map((comment, i) => { return }) } ); } export default Post; const styles = StyleSheet.create({ userName: { fontSize: 14, fontWeight: 'bold', marginBottom: 5, }, card: { margin: 8, backgroundColor: "#FFFFFF" }, comment:{ margin: 8, marginTop: 0, padding: 8 } });