Skip to content

Commit 3471980

Browse files
committed
fix: unread indicator inverted issue on android
1 parent b9a7e86 commit 3471980

File tree

1 file changed

+42
-23
lines changed

1 file changed

+42
-23
lines changed

package/src/components/MessageList/MessageList.tsx

Lines changed: 42 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,20 @@ 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+
641655
const wrapMessageInTheme = client.userID === message.user?.id && !!myMessageTheme;
642656
const renderDateSeperator = isMessageWithStylesReadByAndDateSeparator(message) &&
643657
message.dateSeparator && <InlineDateSeparator date={message.dateSeparator} />;
@@ -657,31 +671,36 @@ const MessageListWithContext = <
657671
/>
658672
);
659673

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}
674+
return wrapMessageInTheme ? (
675+
<>
676+
<ThemeProvider mergedStyle={modifiedTheme}>
677+
<View
678+
style={[shouldApplyAndroidWorkaround ? styles.invertAndroid : undefined]}
679+
testID={`message-list-item-${index}`}
680+
>
681+
{shouldApplyAndroidWorkaround && insertInlineUnreadIndicator && (
682+
<InlineUnreadIndicator />
683+
)}
684+
{shouldApplyAndroidWorkaround && renderDateSeperator}
681685
{renderMessage}
682686
</View>
683-
)}
684-
</View>
687+
</ThemeProvider>
688+
{!shouldApplyAndroidWorkaround && renderDateSeperator}
689+
{!shouldApplyAndroidWorkaround && insertInlineUnreadIndicator && <InlineUnreadIndicator />}
690+
</>
691+
) : (
692+
<>
693+
<View
694+
style={[shouldApplyAndroidWorkaround ? styles.invertAndroid : undefined]}
695+
testID={`message-list-item-${index}`}
696+
>
697+
{shouldApplyAndroidWorkaround && insertInlineUnreadIndicator && <InlineUnreadIndicator />}
698+
{shouldApplyAndroidWorkaround && renderDateSeperator}
699+
{renderMessage}
700+
</View>
701+
{!shouldApplyAndroidWorkaround && renderDateSeperator}
702+
{!shouldApplyAndroidWorkaround && insertInlineUnreadIndicator && <InlineUnreadIndicator />}
703+
</>
685704
);
686705
};
687706

0 commit comments

Comments
 (0)