Skip to content

Commit 927e87c

Browse files
committed
fix: inverted unread indicator due to applied inverted styles
1 parent efe1074 commit 927e87c

File tree

1 file changed

+24
-40
lines changed

1 file changed

+24
-40
lines changed

package/src/components/MessageList/MessageList.tsx

Lines changed: 24 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -638,20 +638,6 @@ const MessageListWithContext = <
638638
scrollToBottomButtonVisible;
639639
const insertInlineUnreadIndicator = showUnreadUnderlay && !isMessageUnread(index + 1); // show only if previous message is read
640640

641-
if (message.type === 'system') {
642-
return (
643-
<View style={[shouldApplyAndroidWorkaround ? styles.invertAndroid : undefined]}>
644-
<View testID={`message-list-item-${index}`}>
645-
<MessageSystem
646-
message={message}
647-
style={[{ paddingHorizontal: screenPadding }, messageContainer]}
648-
/>
649-
</View>
650-
{insertInlineUnreadIndicator && <InlineUnreadIndicator />}
651-
</View>
652-
);
653-
}
654-
655641
const wrapMessageInTheme = client.userID === message.user?.id && !!myMessageTheme;
656642
const renderDateSeperator = isMessageWithStylesReadByAndDateSeparator(message) &&
657643
message.dateSeparator && <InlineDateSeparator date={message.dateSeparator} />;
@@ -670,34 +656,32 @@ const MessageListWithContext = <
670656
threadList={threadList}
671657
/>
672658
);
673-
return wrapMessageInTheme ? (
674-
<>
675-
<ThemeProvider mergedStyle={modifiedTheme}>
676-
<View
677-
style={[shouldApplyAndroidWorkaround ? styles.invertAndroid : undefined]}
678-
testID={`message-list-item-${index}`}
679-
>
680-
{shouldApplyAndroidWorkaround && renderDateSeperator}
659+
660+
return (
661+
<View
662+
style={[shouldApplyAndroidWorkaround ? styles.invertAndroid : undefined]}
663+
testID={`message-list-item-${index}`}
664+
>
665+
{insertInlineUnreadIndicator ? <InlineUnreadIndicator /> : null}
666+
{message.type === 'system' ? (
667+
<MessageSystem
668+
message={message}
669+
style={[{ paddingHorizontal: screenPadding }, messageContainer]}
670+
/>
671+
) : wrapMessageInTheme ? (
672+
<ThemeProvider mergedStyle={modifiedTheme}>
673+
<View testID={`message-list-item-${index}`}>
674+
{renderDateSeperator}
675+
{renderMessage}
676+
</View>
677+
</ThemeProvider>
678+
) : (
679+
<View testID={`message-list-item-${index}`}>
680+
{renderDateSeperator}
681681
{renderMessage}
682682
</View>
683-
</ThemeProvider>
684-
{!shouldApplyAndroidWorkaround && renderDateSeperator}
685-
{/* Adding indicator below the messages, since the list is inverted */}
686-
{insertInlineUnreadIndicator && <InlineUnreadIndicator />}
687-
</>
688-
) : (
689-
<>
690-
<View
691-
style={[shouldApplyAndroidWorkaround ? styles.invertAndroid : undefined]}
692-
testID={`message-list-item-${index}`}
693-
>
694-
{shouldApplyAndroidWorkaround && renderDateSeperator}
695-
{renderMessage}
696-
</View>
697-
{!shouldApplyAndroidWorkaround && renderDateSeperator}
698-
{/* Adding indicator below the messages, since the list is inverted */}
699-
{insertInlineUnreadIndicator && <InlineUnreadIndicator />}
700-
</>
683+
)}
684+
</View>
701685
);
702686
};
703687

0 commit comments

Comments
 (0)