@@ -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 ,
@@ -59,6 +59,7 @@ export type GalleryPropsWithContext = Pick<
5959 | 'VideoThumbnail'
6060 | 'ImageLoadingIndicator'
6161 | 'ImageLoadingFailedIndicator'
62+ | 'ImageReloadIndicator'
6263 | 'myMessageTheme'
6364 > &
6465 Pick < OverlayContextValue , 'setOverlay' > & {
@@ -87,6 +88,7 @@ const GalleryWithContext = (props: GalleryPropsWithContext) => {
8788 hasThreadReplies,
8889 ImageLoadingFailedIndicator,
8990 ImageLoadingIndicator,
91+ ImageReloadIndicator,
9092 images,
9193 legacyImageViewerSwipeBehaviour,
9294 message,
@@ -204,6 +206,7 @@ const GalleryWithContext = (props: GalleryPropsWithContext) => {
204206 colIndex = { colIndex }
205207 ImageLoadingFailedIndicator = { ImageLoadingFailedIndicator }
206208 ImageLoadingIndicator = { ImageLoadingIndicator }
209+ ImageReloadIndicator = { ImageReloadIndicator }
207210 imagesAndVideos = { imagesAndVideos }
208211 invertedDirections = { invertedDirections || false }
209212 key = { rowIndex }
@@ -253,6 +256,7 @@ type GalleryThumbnailProps = {
253256 | 'VideoThumbnail'
254257 | 'ImageLoadingIndicator'
255258 | 'ImageLoadingFailedIndicator'
259+ | 'ImageReloadIndicator'
256260> &
257261 Pick < ImageGalleryContextValue , 'setSelectedMessage' | 'setMessages' > &
258262 Pick < MessageContextValue , 'onLongPress' | 'onPress' | 'onPressIn' | 'preventPress' > &
@@ -264,6 +268,7 @@ const GalleryThumbnail = ({
264268 colIndex,
265269 ImageLoadingFailedIndicator,
266270 ImageLoadingIndicator,
271+ ImageReloadIndicator,
267272 imagesAndVideos,
268273 invertedDirections,
269274 legacyImageViewerSwipeBehaviour,
@@ -296,6 +301,7 @@ const GalleryThumbnail = ({
296301 } ,
297302 } ,
298303 } = useTheme ( ) ;
304+ const { t } = useTranslationContext ( ) ;
299305
300306 const openImageViewer = ( ) => {
301307 if ( ! legacyImageViewerSwipeBehaviour && message ) {
@@ -387,6 +393,7 @@ const GalleryThumbnail = ({
387393 borderRadius = { imageBorderRadius ?? borderRadius }
388394 ImageLoadingFailedIndicator = { ImageLoadingFailedIndicator }
389395 ImageLoadingIndicator = { ImageLoadingIndicator }
396+ ImageReloadIndicator = { ImageReloadIndicator }
390397 thumbnail = { thumbnail }
391398 />
392399 </ View >
@@ -401,7 +408,7 @@ const GalleryThumbnail = ({
401408 ] }
402409 >
403410 < Text style = { [ styles . moreImagesText , moreImagesText ] } >
404- { `+ ${ imagesAndVideos . length - 4 } ` }
411+ { String ( t ( '+{{count}}' , { count : imagesAndVideos . length - 4 } ) ) }
405412 </ Text >
406413 </ View >
407414 ) : null }
@@ -413,10 +420,15 @@ const GalleryImageThumbnail = ({
413420 borderRadius,
414421 ImageLoadingFailedIndicator,
415422 ImageLoadingIndicator,
423+ ImageReloadIndicator,
416424 thumbnail,
417425} : Pick <
418426 GalleryThumbnailProps ,
419- 'ImageLoadingFailedIndicator' | 'ImageLoadingIndicator' | 'thumbnail' | 'borderRadius'
427+ | 'ImageLoadingFailedIndicator'
428+ | 'ImageLoadingIndicator'
429+ | 'ImageReloadIndicator'
430+ | 'thumbnail'
431+ | 'borderRadius'
420432> ) => {
421433 const {
422434 isLoadingImage,
@@ -564,6 +576,7 @@ export const Gallery = (props: GalleryProps) => {
564576 hasThreadReplies,
565577 ImageLoadingFailedIndicator : PropImageLoadingFailedIndicator ,
566578 ImageLoadingIndicator : PropImageLoadingIndicator ,
579+ ImageReloadIndicator : PropImageReloadIndicator ,
567580 images : propImages ,
568581 message : propMessage ,
569582 myMessageTheme : propMyMessageTheme ,
@@ -595,6 +608,7 @@ export const Gallery = (props: GalleryProps) => {
595608 additionalPressableProps : contextAdditionalPressableProps ,
596609 ImageLoadingFailedIndicator : ContextImageLoadingFailedIndicator ,
597610 ImageLoadingIndicator : ContextImageLoadingIndicator ,
611+ ImageReloadIndicator : ContextImageReloadIndicator ,
598612 legacyImageViewerSwipeBehaviour,
599613 myMessageTheme : contextMyMessageTheme ,
600614 VideoThumbnail : ContextVideoThumnbnail ,
@@ -624,6 +638,7 @@ export const Gallery = (props: GalleryProps) => {
624638 const ImageLoadingFailedIndicator =
625639 PropImageLoadingFailedIndicator || ContextImageLoadingFailedIndicator ;
626640 const ImageLoadingIndicator = PropImageLoadingIndicator || ContextImageLoadingIndicator ;
641+ const ImageReloadIndicator = PropImageReloadIndicator || ContextImageReloadIndicator ;
627642 const myMessageTheme = propMyMessageTheme || contextMyMessageTheme ;
628643
629644 return (
@@ -636,6 +651,7 @@ export const Gallery = (props: GalleryProps) => {
636651 hasThreadReplies : hasThreadReplies || ! ! message ?. reply_count ,
637652 ImageLoadingFailedIndicator,
638653 ImageLoadingIndicator,
654+ ImageReloadIndicator,
639655 images,
640656 legacyImageViewerSwipeBehaviour,
641657 message,
0 commit comments