Skip to content

Commit e5afc43

Browse files
committed
fix: add thumbnail info on gallery press handlers
1 parent 34f430a commit e5afc43

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

package/src/components/Attachment/Gallery.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ const GalleryThumbnail = <
332332
onLongPress={(event) => {
333333
if (onLongPress) {
334334
onLongPress({
335+
additionalInfo: { thumbnail },
335336
emitter: 'gallery',
336337
event,
337338
});
@@ -340,6 +341,7 @@ const GalleryThumbnail = <
340341
onPress={(event) => {
341342
if (onPress) {
342343
onPress({
344+
additionalInfo: { thumbnail },
343345
defaultHandler: defaultOnPress,
344346
emitter: 'gallery',
345347
event,
@@ -349,6 +351,7 @@ const GalleryThumbnail = <
349351
onPressIn={(event) => {
350352
if (onPressIn) {
351353
onPressIn({
354+
additionalInfo: { thumbnail },
352355
defaultHandler: defaultOnPress,
353356
emitter: 'gallery',
354357
event,

package/src/components/Message/Message.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import {
4040
isEditedMessage,
4141
MessageStatusTypes,
4242
} from '../../utils/utils';
43+
import type { Thumbnail } from '../Attachment/utils/buildGallery/types';
4344

4445
import {
4546
isMessageWithStylesReadByAndDateSeparator,
@@ -74,16 +75,25 @@ export type FileAttachmentTouchableHandlerPayload<
7475
additionalInfo?: { attachment?: Attachment<StreamChatGenerics> };
7576
};
7677

78+
export type GalleryThumbnailTouchableHandlerPayload = {
79+
emitter: 'gallery';
80+
additionalInfo?: { thumbnail?: Thumbnail };
81+
};
82+
7783
export type PressableHandlerPayload = {
7884
defaultHandler?: () => void;
7985
event?: GestureResponderEvent;
8086
} & (
8187
| {
82-
emitter?: Exclude<TouchableEmitter, 'textMention' | 'textLink' | 'card' | 'fileAttachment'>;
88+
emitter?: Exclude<
89+
TouchableEmitter,
90+
'textMention' | 'textLink' | 'card' | 'fileAttachment' | 'gallery'
91+
>;
8392
}
8493
| TextMentionTouchableHandlerPayload
8594
| UrlTouchableHandlerPayload
8695
| FileAttachmentTouchableHandlerPayload
96+
| GalleryThumbnailTouchableHandlerPayload
8797
);
8898

8999
export type MessagePressableHandlerPayload<

0 commit comments

Comments
 (0)