Fix list rendering keys and nested list patterns

This commit is contained in:
Adolfo Reyna
2026-02-20 20:13:10 -05:00
parent 487edb4a62
commit d2491800f2
6 changed files with 45 additions and 52 deletions

View File

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