Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 23 additions & 37 deletions src/components/Reactions/EmojiReactionBubble.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,8 @@ import withCurrentUserPersonalDetails, {
withCurrentUserPersonalDetailsPropTypes,
} from '../withCurrentUserPersonalDetails';
import * as Report from '../../libs/actions/Report';
import Tooltip from '../Tooltip';
import ReactionTooltipContent from './ReactionTooltipContent';

const propTypes = {
emojiName: PropTypes.string.isRequired,

Comment thread
neil-marcellini marked this conversation as resolved.
/**
* The emoji codes to display in the bubble.
*/
Expand Down Expand Up @@ -63,41 +59,31 @@ const defaultProps = {
const EmojiReactionBubble = (props) => {
const hasUserReacted = Report.hasAccountIDReacted(props.currentUserPersonalDetails.accountID, props.reactionUsers);
return (
<Tooltip
renderTooltipContent={() => (
<ReactionTooltipContent
emojiName={props.emojiName}
emojiCodes={props.emojiCodes}
accountIDs={props.reactionUsers}
/>
)}
<Pressable
style={({hovered, pressed}) => [
styles.emojiReactionBubble,
StyleUtils.getEmojiReactionBubbleStyle(hovered || pressed, hasUserReacted, props.sizeScale),
]}
onPress={props.onPress}
onLongPress={props.onReactionListOpen}
>
<Pressable
style={({hovered, pressed}) => [
styles.emojiReactionBubble,
StyleUtils.getEmojiReactionBubbleStyle(hovered || pressed, hasUserReacted, props.sizeScale),
]}
onPress={props.onPress}
onLongPress={props.onReactionListOpen}
<Text style={[
styles.emojiReactionText,
StyleUtils.getEmojiReactionTextStyle(props.sizeScale),
]}
>
<Text style={[
styles.emojiReactionText,
StyleUtils.getEmojiReactionTextStyle(props.sizeScale),
]}
>
{props.emojiCodes.join('')}
</Text>
{props.count > 0 && (
<Text style={[
styles.reactionCounterText,
StyleUtils.getEmojiReactionCounterTextStyle(hasUserReacted, props.sizeScale),
]}
>
{props.count}
</Text>
)}
</Pressable>
</Tooltip>
{props.emojiCodes.join('')}
</Text>
{props.count > 0 && (
<Text style={[
styles.reactionCounterText,
StyleUtils.getEmojiReactionCounterTextStyle(hasUserReacted, props.sizeScale),
]}
>
{props.count}
</Text>
)}
</Pressable>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ const BaseQuickEmojiReactions = props => (
// Note: focus is handled by the Pressable component in EmojiReactionBubble
<Tooltip text={`:${emoji.name}:`} key={emoji.name} focusable={false}>
<EmojiReactionBubble
emojiName={emoji.name}
emojiCodes={[getPreferredEmojiCode(emoji, props.preferredSkinTone)]}
sizeScale={EMOJI_BUBBLE_SCALE}
onPress={() => {
Expand Down
27 changes: 19 additions & 8 deletions src/components/Reactions/ReportActionItemReactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import EmojiReactionBubble from './EmojiReactionBubble';
import emojis from '../../../assets/emojis';
import AddReactionBubble from './AddReactionBubble';
import getPreferredEmojiCode from './getPreferredEmojiCode';
import Tooltip from '../Tooltip';
import ReactionTooltipContent from './ReactionTooltipContent';

/**
* Given an emoji object and a list of senders it will return an
Expand Down Expand Up @@ -68,14 +70,23 @@ const ReportActionItemReactions = (props) => {
};

return (
<EmojiReactionBubble
key={reaction.emoji}
count={reactionCount}
emojiName={reaction.emoji}
emojiCodes={emojiCodes}
onPress={onPress}
reactionUsers={reactionUsers}
/>
<Tooltip
renderTooltipContent={() => (
<ReactionTooltipContent
emojiName={reaction.emoji}
emojiCodes={emojiCodes}
accountIDs={reactionUsers}
/>
)}
>
<EmojiReactionBubble
key={reaction.emoji}
count={reactionCount}
emojiCodes={emojiCodes}
onPress={onPress}
reactionUsers={reactionUsers}
/>
</Tooltip>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we are passing emojiName here?

@Pujan92 Pujan92 Mar 21, 2023

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To show the emoji name in the tooltip.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm asking why for EmojiReactionBubble?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh, it is not required for EmojiReactionBubble. Will remove it.
Thanks

);
})}
{reactionsWithCount.length > 0 && <AddReactionBubble onSelectEmoji={props.toggleReaction} />}
Expand Down