Two fixes to react-key generation (#2004)
* Fix missing react keys in ListMembers * Fix react key construction for the posts feedzio/stable
parent
1dc017367e
commit
cd43adf698
|
@ -19,8 +19,9 @@ export class FeedViewPostsSlice {
|
||||||
constructor(public items: FeedViewPost[] = []) {}
|
constructor(public items: FeedViewPost[] = []) {}
|
||||||
|
|
||||||
get _reactKey() {
|
get _reactKey() {
|
||||||
return `slice-${this.items[0].post.uri}-${
|
const rootItem = this.isFlattenedReply ? this.items[1] : this.items[0]
|
||||||
this.items[0].reason?.indexedAt || this.items[0].post.indexedAt
|
return `slice-${rootItem.post.uri}-${
|
||||||
|
rootItem.reason?.indexedAt || rootItem.post.indexedAt
|
||||||
}`
|
}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -215,7 +215,7 @@ export function ListMembers({
|
||||||
testID={testID ? `${testID}-flatlist` : undefined}
|
testID={testID ? `${testID}-flatlist` : undefined}
|
||||||
ref={scrollElRef}
|
ref={scrollElRef}
|
||||||
data={items}
|
data={items}
|
||||||
keyExtractor={(item: any) => item.uri || item._reactKey}
|
keyExtractor={(item: any) => item.subject?.did || item._reactKey}
|
||||||
renderItem={renderItem}
|
renderItem={renderItem}
|
||||||
ListHeaderComponent={renderHeader}
|
ListHeaderComponent={renderHeader}
|
||||||
ListFooterComponent={Footer}
|
ListFooterComponent={Footer}
|
||||||
|
|
Loading…
Reference in New Issue