Skip to content

Commit 412ea35

Browse files
authored
Merge pull request #2912 from GetStream/fix/backport-attachment-thumbnail-fix
fix: backport attachment thumbnail fix
2 parents dc870d7 + d78954e commit 412ea35

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

package/src/components/Attachment/Gallery.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ const GalleryThumbnail = <
330330
onLongPress={(event) => {
331331
if (onLongPress) {
332332
onLongPress({
333+
additionalInfo: { thumbnail },
333334
emitter: 'gallery',
334335
event,
335336
});
@@ -338,6 +339,7 @@ const GalleryThumbnail = <
338339
onPress={(event) => {
339340
if (onPress) {
340341
onPress({
342+
additionalInfo: { thumbnail },
341343
defaultHandler: defaultOnPress,
342344
emitter: 'gallery',
343345
event,
@@ -347,6 +349,7 @@ const GalleryThumbnail = <
347349
onPressIn={(event) => {
348350
if (onPressIn) {
349351
onPressIn({
352+
additionalInfo: { thumbnail },
350353
defaultHandler: defaultOnPress,
351354
emitter: 'gallery',
352355
event,

package/src/components/Message/Message.tsx

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import {
4848
isEditedMessage,
4949
MessageStatusTypes,
5050
} from '../../utils/utils';
51+
import type { Thumbnail } from '../Attachment/utils/buildGallery/types';
5152

5253
import {
5354
isMessageWithStylesReadByAndDateSeparator,
@@ -65,35 +66,56 @@ export type TouchableEmitter =
6566
| 'messageReplies'
6667
| 'reactionList';
6768

69+
export type TextMentionTouchableHandlerAdditionalInfo<
70+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
71+
> = { user?: UserResponse<StreamChatGenerics> };
72+
6873
export type TextMentionTouchableHandlerPayload<
6974
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
7075
> = {
7176
emitter: 'textMention';
72-
additionalInfo?: { user?: UserResponse<StreamChatGenerics> };
77+
additionalInfo?: TextMentionTouchableHandlerAdditionalInfo<StreamChatGenerics>;
7378
};
7479

80+
export type UrlTouchableHandlerAdditionalInfo = { url?: string };
81+
7582
export type UrlTouchableHandlerPayload = {
7683
emitter: 'textLink' | 'card';
77-
additionalInfo?: { url?: string };
84+
additionalInfo?: UrlTouchableHandlerAdditionalInfo;
7885
};
7986

87+
export type FileAttachmentTouchableHandlerAdditionalInfo<
88+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
89+
> = { attachment?: Attachment<StreamChatGenerics> };
90+
8091
export type FileAttachmentTouchableHandlerPayload<
8192
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
8293
> = {
8394
emitter: 'fileAttachment';
84-
additionalInfo?: { attachment?: Attachment<StreamChatGenerics> };
95+
additionalInfo?: FileAttachmentTouchableHandlerAdditionalInfo<StreamChatGenerics>;
96+
};
97+
98+
export type GalleryThumbnailTouchableHandlerAdditionalInfo = { thumbnail?: Thumbnail };
99+
100+
export type GalleryThumbnailTouchableHandlerPayload = {
101+
emitter: 'gallery';
102+
additionalInfo?: GalleryThumbnailTouchableHandlerAdditionalInfo;
85103
};
86104

87105
export type TouchableHandlerPayload = {
88106
defaultHandler?: () => void;
89107
event?: GestureResponderEvent;
90108
} & (
91109
| {
92-
emitter?: Exclude<TouchableEmitter, 'textMention' | 'textLink' | 'card' | 'fileAttachment'>;
110+
emitter?: Exclude<
111+
TouchableEmitter,
112+
'textMention' | 'textLink' | 'card' | 'fileAttachment' | 'gallery'
113+
>;
93114
}
94115
| TextMentionTouchableHandlerPayload
95116
| UrlTouchableHandlerPayload
96117
| FileAttachmentTouchableHandlerPayload
118+
| GalleryThumbnailTouchableHandlerPayload
97119
);
98120

99121
export type MessageTouchableHandlerPayload<

0 commit comments

Comments
 (0)