Open comments on singlepost view

This commit is contained in:
Adolfo Reyna
2025-02-22 00:00:29 -05:00
parent 0ae13c9ffe
commit ad394a6f18
3 changed files with 20 additions and 10 deletions

View File

@@ -1,9 +1,9 @@
import React, { useState, useEffect } from 'react';
import { ScrollView } from 'react-native';
import { FlatList } from 'react-native';
import API from './../API.js';
import Post from './Post.js';
let SinglePostComponent = ({ postId }) => {
let SinglePostComponent = ({ postId, hideComments }) => {
let [post, setPost] = useState({});
useEffect(() => {
let subscribed = true;
@@ -19,9 +19,12 @@ let SinglePostComponent = ({ postId }) => {
}
}, [postId]);
return (post._id ? (
<ScrollView>
<Post post={post}/>
</ScrollView>
<FlatList
data={[post]}
renderItem={({ item }) => <Post post={item} showComments={hideComments ? false : true}/>}
keyExtractor={item => item._id}
/>
) : null);
};