Skip to content

Commit 32dd65c

Browse files
authored
fix: message list sub components props (#3201)
* fix: message list sub components props * fix: message list sub components props
1 parent 074e4ac commit 32dd65c

File tree

2 files changed

+4
-19
lines changed

2 files changed

+4
-19
lines changed

package/src/components/MessageList/MessageList.tsx

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,27 +1143,14 @@ const MessageListWithContext = (props: MessageListPropsWithContext) => {
11431143
}
11441144
}
11451145

1146-
const ListFooterComponent = useCallback(() => <FooterComponent />, [FooterComponent]);
1147-
1148-
const ListHeaderComponent = useCallback(() => <HeaderComponent />, [HeaderComponent]);
1149-
1150-
const ItemSeparatorComponent = additionalFlatListProps?.ItemSeparatorComponent;
1151-
const WrappedItemSeparatorComponent = useCallback(() => {
1152-
return ItemSeparatorComponent ? <ItemSeparatorComponent /> : null;
1153-
}, [ItemSeparatorComponent]);
1154-
11551146
// We need to omit the style related props from the additionalFlatListProps and add them directly instead of spreading
11561147
let additionalFlatListPropsExcludingStyle:
1157-
| Omit<
1158-
NonNullable<typeof additionalFlatListProps>,
1159-
'style' | 'contentContainerStyle' | 'ItemSeparatorComponent'
1160-
>
1148+
| Omit<NonNullable<typeof additionalFlatListProps>, 'style' | 'contentContainerStyle'>
11611149
| undefined;
11621150

11631151
if (additionalFlatListProps) {
11641152
// eslint-disable-next-line @typescript-eslint/no-unused-vars
1165-
const { contentContainerStyle, ItemSeparatorComponent, style, ...rest } =
1166-
additionalFlatListProps;
1153+
const { contentContainerStyle, style, ...rest } = additionalFlatListProps;
11671154
additionalFlatListPropsExcludingStyle = rest;
11681155
}
11691156

@@ -1210,11 +1197,10 @@ const MessageListWithContext = (props: MessageListPropsWithContext) => {
12101197
data={processedMessageList}
12111198
extraData={disabled}
12121199
inverted={inverted}
1213-
ItemSeparatorComponent={WrappedItemSeparatorComponent}
12141200
keyboardShouldPersistTaps='handled'
12151201
keyExtractor={keyExtractor}
1216-
ListFooterComponent={ListFooterComponent}
1217-
ListHeaderComponent={ListHeaderComponent}
1202+
ListFooterComponent={FooterComponent}
1203+
ListHeaderComponent={HeaderComponent}
12181204
/**
12191205
If autoscrollToTopThreshold is 10, we scroll to recent only if before the update, the list was already at the
12201206
bottom (10 offset or below).

package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ exports[`Thread should match thread snapshot 1`] = `
3434
testID="message-flat-list-wrapper"
3535
>
3636
<RCTScrollView
37-
ItemSeparatorComponent={[Function]}
3837
ListFooterComponent={null}
3938
ListHeaderComponent={[Function]}
4039
contentContainerStyle={

0 commit comments

Comments
 (0)