Fix list rendering keys and nested list patterns
This commit is contained in:
@@ -49,7 +49,7 @@ let Post = (props) => {
|
||||
<FlatList data={userIds}
|
||||
horizontal={true}
|
||||
renderItem={renderPost}
|
||||
//keyExtractor={item => item}
|
||||
keyExtractor={(item, index) => `${item}-${index}`}
|
||||
/>
|
||||
</View>
|
||||
</Card.Content>
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user