diff --git a/native/chat/composed-message.react.js b/native/chat/composed-message.react.js --- a/native/chat/composed-message.react.js +++ b/native/chat/composed-message.react.js @@ -138,7 +138,7 @@ ); let inlineSidebar = null; - if (item.threadCreatedFromMessage) { + if (item.threadCreatedFromMessage || item.reactions.size > 0) { const positioning = isViewer ? 'right' : 'left'; const inlineSidebarPositionStyle = positioning === 'left' @@ -146,7 +146,10 @@ : styles.rightInlineSidebar; inlineSidebar = ( - + ); } diff --git a/native/chat/inline-sidebar.react.js b/native/chat/inline-sidebar.react.js --- a/native/chat/inline-sidebar.react.js +++ b/native/chat/inline-sidebar.react.js @@ -1,5 +1,6 @@ // @flow +import invariant from 'invariant'; import * as React from 'react'; import { Text, View } from 'react-native'; import Animated, { @@ -8,6 +9,7 @@ } from 'react-native-reanimated'; import useInlineSidebarText from 'lib/hooks/inline-sidebar-text.react'; +import type { MessageReactionInfo } from 'lib/selectors/chat-selectors'; import type { ThreadInfo } from 'lib/types/thread-types'; import CommIcon from '../components/comm-icon.react'; @@ -24,7 +26,7 @@ type Props = { +threadInfo: ?ThreadInfo, - +reactions?: $ReadOnlyArray, + +reactions?: $ReadOnlyMap, +disabled?: boolean, }; function InlineSidebar(props: Props): React.Node { @@ -41,16 +43,28 @@ const styles = useStyles(unboundStyles); const reactionList = React.useMemo(() => { - if (!reactions || reactions.length === 0) { + if (!reactions || reactions.size === 0) { return null; } - const reactionItems = reactions.map(reaction => { - return ( - - {reaction} - - ); - }); + + let reactionText = ''; + let index = 0; + for (const key of reactions.keys()) { + const reactionInfo = reactions.get(key); + invariant(reactionInfo, 'reactionInfo should be set'); + + if (index > 0) { + reactionText += ' '; + } + reactionText += key; + if (reactionInfo.users.size > 1) { + reactionText += ` ${reactionInfo.users.size}`; + } + index++; + } + + const reactionItems = {reactionText}; + return {reactionItems}; }, [reactions, styles.reaction, styles.reactionsContainer]); diff --git a/native/chat/robotext-message.react.js b/native/chat/robotext-message.react.js --- a/native/chat/robotext-message.react.js +++ b/native/chat/robotext-message.react.js @@ -54,10 +54,13 @@ const styles = useStyles(unboundStyles); let inlineSidebar = null; - if (item.threadCreatedFromMessage) { + if (item.threadCreatedFromMessage || item.reactions.size > 0) { inlineSidebar = ( - + ); }