diff --git a/package/src/components/MessageList/MessageList.tsx b/package/src/components/MessageList/MessageList.tsx index c60ee66a3f..1662ba74c2 100644 --- a/package/src/components/MessageList/MessageList.tsx +++ b/package/src/components/MessageList/MessageList.tsx @@ -88,10 +88,6 @@ const styles = StyleSheet.create({ }, }); -const InvertedCellRendererComponent = (props: React.PropsWithChildren) => ( - -); - const keyExtractor = < StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics, >( @@ -634,7 +630,7 @@ const MessageListWithContext = < if (message.type === 'system') { return ( - <> + {insertInlineUnreadIndicator && } - + ); } @@ -668,7 +664,12 @@ const MessageListWithContext = < <> {shouldApplyAndroidWorkaround && renderDateSeperator} - {renderMessage} + + {renderMessage} + {!shouldApplyAndroidWorkaround && renderDateSeperator} {/* Adding indicator below the messages, since the list is inverted */} @@ -676,7 +677,10 @@ const MessageListWithContext = < ) : ( <> - + {shouldApplyAndroidWorkaround && renderDateSeperator} {renderMessage} @@ -1081,14 +1085,28 @@ const MessageListWithContext = < [shouldApplyAndroidWorkaround, HeaderComponent], ); + const ItemSeparatorComponent = additionalFlatListProps?.ItemSeparatorComponent; + const WrappedItemSeparatorComponent = useCallback( + () => ( + + {ItemSeparatorComponent ? : null} + + ), + [ItemSeparatorComponent, shouldApplyAndroidWorkaround], + ); + // We need to omit the style related props from the additionalFlatListProps and add them directly instead of spreading let additionalFlatListPropsExcludingStyle: - | Omit, 'style' | 'contentContainerStyle'> + | Omit< + NonNullable, + 'style' | 'contentContainerStyle' | 'ItemSeparatorComponent' + > | undefined; if (additionalFlatListProps) { // eslint-disable-next-line @typescript-eslint/no-unused-vars - const { contentContainerStyle, style, ...rest } = additionalFlatListProps; + const { contentContainerStyle, ItemSeparatorComponent, style, ...rest } = + additionalFlatListProps; additionalFlatListPropsExcludingStyle = rest; } @@ -1114,9 +1132,6 @@ const MessageListWithContext = < ) : ( + +