diff --git a/native/chat/chat-thread-list-item.react.js b/native/chat/chat-thread-list-item.react.js
--- a/native/chat/chat-thread-list-item.react.js
+++ b/native/chat/chat-thread-list-item.react.js
@@ -42,23 +42,6 @@
const styles = useStyles(unboundStyles);
const colors = useColors();
- const lastMessage = React.useMemo(() => {
- const mostRecentMessageInfo = data.mostRecentMessageInfo;
- if (!mostRecentMessageInfo) {
- return (
-
- No messages
-
- );
- }
- return (
-
- );
- }, [data.mostRecentMessageInfo, data.threadInfo, styles]);
-
const numOfSidebarsWithExtendedArrow =
data.sidebars.filter(sidebarItem => sidebarItem.type === 'sidebar').length -
1;
@@ -172,7 +155,10 @@
- {lastMessage}
+
{lastActivity}
@@ -183,13 +169,13 @@
iconName,
lastActivity,
lastActivityStyle,
- lastMessage,
resolvedThreadInfo.uiName,
styles.header,
styles.iconContainer,
styles.row,
styles.threadDetails,
threadNameStyle,
+ data.mostRecentMessageInfo,
],
);
@@ -287,12 +273,6 @@
color: 'listForegroundLabel',
fontWeight: 'bold',
},
- noMessages: {
- color: 'listForegroundTertiaryLabel',
- flex: 1,
- fontSize: 14,
- fontStyle: 'italic',
- },
row: {
flexDirection: 'row',
justifyContent: 'space-between',
diff --git a/native/chat/message-preview.react.js b/native/chat/message-preview.react.js
--- a/native/chat/message-preview.react.js
+++ b/native/chat/message-preview.react.js
@@ -14,7 +14,7 @@
import { useStyles } from '../themes/colors.js';
type Props = {
- +messageInfo: MessageInfo,
+ +messageInfo: ?MessageInfo,
+threadInfo: ThreadInfo,
};
function MessagePreview(props: Props): React.Node {
@@ -26,14 +26,17 @@
threadInfo,
getDefaultTextMessageRules(chatMentionCandidates).simpleMarkdownRules,
);
- invariant(
- messagePreviewResult,
- 'useMessagePreview should only return falsey if pass null or undefined',
- );
+ const styles = useStyles(unboundStyles);
+ if (!messagePreviewResult) {
+ return (
+
+ No messages
+
+ );
+ }
const { message, username } = messagePreviewResult;
let messageStyle;
- const styles = useStyles(unboundStyles);
if (message.style === 'unread') {
messageStyle = styles.unread;
} else if (message.style === 'primary') {
@@ -88,6 +91,12 @@
unread: {
color: 'listForegroundLabel',
},
+ noMessages: {
+ color: 'listForegroundTertiaryLabel',
+ flex: 1,
+ fontSize: 14,
+ fontStyle: 'italic',
+ },
};
export default MessagePreview;
diff --git a/native/chat/subchannel-item.react.js b/native/chat/subchannel-item.react.js
--- a/native/chat/subchannel-item.react.js
+++ b/native/chat/subchannel-item.react.js
@@ -25,22 +25,6 @@
const styles = useStyles(unboundStyles);
const unreadStyle = threadInfo.currentUser.unread ? styles.unread : null;
- const lastMessage = React.useMemo(() => {
- if (!mostRecentMessageInfo) {
- return (
-
- No messages
-
- );
- }
- return (
-
- );
- }, [mostRecentMessageInfo, threadInfo, styles]);
-
return (
@@ -53,7 +37,10 @@
{uiName}
- {lastMessage}
+
{lastActivity}
@@ -98,12 +85,6 @@
alignItems: 'center',
height: 24,
},
- noMessages: {
- color: 'listForegroundTertiaryLabel',
- flex: 1,
- fontSize,
- fontStyle: 'italic',
- },
};
export default SubchannelItem;