@@ -4,7 +4,6 @@ import { Pressable, StyleSheet, Text, View } from 'react-native';
44import type { Attachment } from 'stream-chat' ;
55
66import { GalleryImage } from './GalleryImage' ;
7- import { ImageReloadIndicator } from './ImageReloadIndicator' ;
87import { buildGallery } from './utils/buildGallery/buildGallery' ;
98
109import type { Thumbnail } from './utils/buildGallery/types' ;
@@ -13,6 +12,7 @@ import { getGalleryImageBorderRadius } from './utils/getGalleryImageBorderRadius
1312import { openUrlSafely } from './utils/openUrlSafely' ;
1413
1514import type { MessageType } from '../../components/MessageList/hooks/useMessageList' ;
15+ import { useTranslationContext } from '../../contexts' ;
1616import { useChatConfigContext } from '../../contexts/chatConfigContext/ChatConfigContext' ;
1717import {
1818 ImageGalleryContextValue ,
@@ -58,6 +58,7 @@ export type GalleryPropsWithContext<
5858 | 'VideoThumbnail'
5959 | 'ImageLoadingIndicator'
6060 | 'ImageLoadingFailedIndicator'
61+ | 'ImageReloadIndicator'
6162 | 'myMessageTheme'
6263 > &
6364 Pick < OverlayContextValue , 'setOverlay' > & {
@@ -90,6 +91,7 @@ const GalleryWithContext = <
9091 hasThreadReplies,
9192 ImageLoadingFailedIndicator,
9293 ImageLoadingIndicator,
94+ ImageReloadIndicator,
9395 images,
9496 legacyImageViewerSwipeBehaviour,
9597 message,
@@ -207,6 +209,7 @@ const GalleryWithContext = <
207209 colIndex = { colIndex }
208210 ImageLoadingFailedIndicator = { ImageLoadingFailedIndicator }
209211 ImageLoadingIndicator = { ImageLoadingIndicator }
212+ ImageReloadIndicator = { ImageReloadIndicator }
210213 imagesAndVideos = { imagesAndVideos }
211214 invertedDirections = { invertedDirections || false }
212215 key = { rowIndex }
@@ -258,6 +261,7 @@ type GalleryThumbnailProps<
258261 | 'VideoThumbnail'
259262 | 'ImageLoadingIndicator'
260263 | 'ImageLoadingFailedIndicator'
264+ | 'ImageReloadIndicator'
261265> &
262266 Pick < ImageGalleryContextValue < StreamChatGenerics > , 'setSelectedMessage' | 'setMessages' > &
263267 Pick <
@@ -274,6 +278,7 @@ const GalleryThumbnail = <
274278 colIndex,
275279 ImageLoadingFailedIndicator,
276280 ImageLoadingIndicator,
281+ ImageReloadIndicator,
277282 imagesAndVideos,
278283 invertedDirections,
279284 legacyImageViewerSwipeBehaviour,
@@ -306,6 +311,7 @@ const GalleryThumbnail = <
306311 } ,
307312 } ,
308313 } = useTheme ( ) ;
314+ const { t } = useTranslationContext ( ) ;
309315
310316 const openImageViewer = ( ) => {
311317 if ( ! legacyImageViewerSwipeBehaviour && message ) {
@@ -397,6 +403,7 @@ const GalleryThumbnail = <
397403 borderRadius = { imageBorderRadius ?? borderRadius }
398404 ImageLoadingFailedIndicator = { ImageLoadingFailedIndicator }
399405 ImageLoadingIndicator = { ImageLoadingIndicator }
406+ ImageReloadIndicator = { ImageReloadIndicator }
400407 thumbnail = { thumbnail }
401408 />
402409 </ View >
@@ -411,7 +418,7 @@ const GalleryThumbnail = <
411418 ] }
412419 >
413420 < Text style = { [ styles . moreImagesText , moreImagesText ] } >
414- { `+ ${ imagesAndVideos . length - 4 } ` }
421+ { String ( t ( '+{{count}}' , { count : imagesAndVideos . length - 4 } ) ) }
415422 </ Text >
416423 </ View >
417424 ) : null }
@@ -425,10 +432,15 @@ const GalleryImageThumbnail = <
425432 borderRadius,
426433 ImageLoadingFailedIndicator,
427434 ImageLoadingIndicator,
435+ ImageReloadIndicator,
428436 thumbnail,
429437} : Pick <
430438 GalleryThumbnailProps < StreamChatGenerics > ,
431- 'ImageLoadingFailedIndicator' | 'ImageLoadingIndicator' | 'thumbnail' | 'borderRadius'
439+ | 'ImageLoadingFailedIndicator'
440+ | 'ImageLoadingIndicator'
441+ | 'ImageReloadIndicator'
442+ | 'thumbnail'
443+ | 'borderRadius'
432444> ) => {
433445 const {
434446 isLoadingImage,
@@ -585,6 +597,7 @@ export const Gallery = <
585597 hasThreadReplies,
586598 ImageLoadingFailedIndicator : PropImageLoadingFailedIndicator ,
587599 ImageLoadingIndicator : PropImageLoadingIndicator ,
600+ ImageReloadIndicator : PropImageReloadIndicator ,
588601 images : propImages ,
589602 message : propMessage ,
590603 myMessageTheme : propMyMessageTheme ,
@@ -617,6 +630,7 @@ export const Gallery = <
617630 additionalPressableProps : contextAdditionalPressableProps ,
618631 ImageLoadingFailedIndicator : ContextImageLoadingFailedIndicator ,
619632 ImageLoadingIndicator : ContextImageLoadingIndicator ,
633+ ImageReloadIndicator : ContextImageReloadIndicator ,
620634 legacyImageViewerSwipeBehaviour,
621635 myMessageTheme : contextMyMessageTheme ,
622636 VideoThumbnail : ContextVideoThumnbnail ,
@@ -646,6 +660,7 @@ export const Gallery = <
646660 const ImageLoadingFailedIndicator =
647661 PropImageLoadingFailedIndicator || ContextImageLoadingFailedIndicator ;
648662 const ImageLoadingIndicator = PropImageLoadingIndicator || ContextImageLoadingIndicator ;
663+ const ImageReloadIndicator = PropImageReloadIndicator || ContextImageReloadIndicator ;
649664 const myMessageTheme = propMyMessageTheme || contextMyMessageTheme ;
650665
651666 return (
@@ -658,6 +673,7 @@ export const Gallery = <
658673 hasThreadReplies : hasThreadReplies || ! ! message ?. reply_count ,
659674 ImageLoadingFailedIndicator,
660675 ImageLoadingIndicator,
676+ ImageReloadIndicator,
661677 images,
662678 legacyImageViewerSwipeBehaviour,
663679 message,
0 commit comments