Skip to content

Commit

Permalink
Extra fix for invisible reactions;
Browse files Browse the repository at this point in the history
  • Loading branch information
stef-coenen committed Aug 23, 2024
1 parent 958764f commit 9e1cc28
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 24 deletions.
10 changes: 5 additions & 5 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module.exports = {
presets: ['module:@react-native/babel-preset'],
plugins: ['react-native-reanimated/plugin'],
env: {
production: {
plugins: ['transform-remove-console'],
},
},
// env: {
// production: {
// plugins: ['transform-remove-console'],
// },
// },
};
10 changes: 5 additions & 5 deletions packages/mobile/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module.exports = {
presets: ['module:@react-native/babel-preset'],
plugins: ['react-native-reanimated/plugin'],
env: {
production: {
plugins: ['transform-remove-console'],
},
},
// env: {
// production: {
// plugins: ['transform-remove-console'],
// },
// },
};
2 changes: 1 addition & 1 deletion packages/mobile/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1669,7 +1669,7 @@ SPEC CHECKSUMS:
RNSVG: 50cf2c7018e57cf5d3522d98d0a3a4dd6bf9d093
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
SSZipArchive: 62d4947b08730e4cda640473b0066d209ff033c9
Yoga: 805bf71192903b20fc14babe48080582fee65a80
Yoga: d17d2cc8105eed528474683b42e2ea310e1daf61
ZIPFoundation: b8c29ea7ae353b309bc810586181fd073cb3312c

PODFILE CHECKSUM: f32ae1d81504ba80ec01963a7150115ccbbf36fb
Expand Down
23 changes: 10 additions & 13 deletions packages/mobile/src/components/Chat/ChatDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ import ChatMessageBox from '../../components/Chat/Chat-Message-box';
import { OdinImage } from '../../components/ui/OdinImage/OdinImage';
import { useDarkMode } from '../../hooks/useDarkMode';
import { ChatDeliveryIndicator } from '../../components/Chat/Chat-Delivery-Indicator';
import { useChatReaction } from '../../hooks/chat/useChatReaction';
import { Avatar as AppAvatar, OwnerAvatar } from '../../components/ui/Avatars/Avatar';
import { AuthorName, ConnectionName } from '../../components/ui/Name';
import { HomebaseFile } from '@youfoundation/js-lib/core';
Expand All @@ -82,6 +81,7 @@ import { ParseShape } from 'react-native-gifted-chat/src/MessageText';
import { MentionDropDown } from './Mention-Dropdown';
import { LinkPreviewBar } from './Link-Preview-Bar';
import { LinkPreview } from '@youfoundation/js-lib/media';
import { tryJsonParse } from '@youfoundation/js-lib/helpers';

export type ChatMessageIMessage = IMessage & HomebaseFile<ChatMessage>;

Expand Down Expand Up @@ -902,23 +902,20 @@ const RenderBubble = memo(
false;
const isReply = !!content?.replyId;
const showBackground = !isEmojiOnly || isReply;
const { data: reactions } = useChatReaction({
messageFileId: message?.fileId,
messageGlobalTransitId: message?.fileMetadata.globalTransitId,
}).get;

const onRetryOpen = useCallback(() => {
props.onRetryClick(message);
}, [message, props]);

const reactions =
(message.fileMetadata.reactionPreview?.reactions &&
Object.values(message.fileMetadata.reactionPreview?.reactions).map((reaction) => {
return tryJsonParse<{ emoji: string }>(reaction.reactionContent).emoji;
})) ||
[];
const filteredEmojis = Array.from(new Set(reactions));
const hasReactions = (reactions && reactions?.length > 0) || false;
const filteredEmojis = useMemo(
() =>
reactions?.filter((reaction) =>
reactions?.some((reactionFile) => reactionFile?.body === reaction?.body)
) || [],
[reactions]
);

// has pauload and no text but no audio payload
const hasPayloadandNoText =
message?.fileMetadata.payloads?.length > 0 &&
Expand Down Expand Up @@ -1011,7 +1008,7 @@ const RenderBubble = memo(
marginRight: 2,
}}
>
{reaction.body}
{reaction}
</Text>
);
})}
Expand Down

0 comments on commit 9e1cc28

Please sign in to comment.