@@ -4,14 +4,14 @@ import { Pressable, StyleSheet, Text, View } from 'react-native';
44import type { Attachment , LocalMessage } 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' ;
1110import { getGalleryImageBorderRadius } from './utils/getGalleryImageBorderRadius' ;
1211
1312import { openUrlSafely } from './utils/openUrlSafely' ;
1413
14+ import { useTranslationContext } from '../../contexts' ;
1515import { useChatConfigContext } from '../../contexts/chatConfigContext/ChatConfigContext' ;
1616import {
1717 ImageGalleryContextValue ,
@@ -58,6 +58,7 @@ export type GalleryPropsWithContext = Pick<
5858 | 'VideoThumbnail'
5959 | 'ImageLoadingIndicator'
6060 | 'ImageLoadingFailedIndicator'
61+ | 'ImageReloadIndicator'
6162 | 'myMessageTheme'
6263 > &
6364 Pick < OverlayContextValue , 'setOverlay' > & {
@@ -86,6 +87,7 @@ const GalleryWithContext = (props: GalleryPropsWithContext) => {
8687 hasThreadReplies,
8788 ImageLoadingFailedIndicator,
8889 ImageLoadingIndicator,
90+ ImageReloadIndicator,
8991 images,
9092 legacyImageViewerSwipeBehaviour,
9193 message,
@@ -203,6 +205,7 @@ const GalleryWithContext = (props: GalleryPropsWithContext) => {
203205 colIndex = { colIndex }
204206 ImageLoadingFailedIndicator = { ImageLoadingFailedIndicator }
205207 ImageLoadingIndicator = { ImageLoadingIndicator }
208+ ImageReloadIndicator = { ImageReloadIndicator }
206209 imagesAndVideos = { imagesAndVideos }
207210 invertedDirections = { invertedDirections || false }
208211 key = { rowIndex }
@@ -252,6 +255,7 @@ type GalleryThumbnailProps = {
252255 | 'VideoThumbnail'
253256 | 'ImageLoadingIndicator'
254257 | 'ImageLoadingFailedIndicator'
258+ | 'ImageReloadIndicator'
255259> &
256260 Pick < ImageGalleryContextValue , 'setSelectedMessage' | 'setMessages' > &
257261 Pick < MessageContextValue , 'onLongPress' | 'onPress' | 'onPressIn' | 'preventPress' > &
@@ -263,6 +267,7 @@ const GalleryThumbnail = ({
263267 colIndex,
264268 ImageLoadingFailedIndicator,
265269 ImageLoadingIndicator,
270+ ImageReloadIndicator,
266271 imagesAndVideos,
267272 invertedDirections,
268273 legacyImageViewerSwipeBehaviour,
@@ -295,6 +300,7 @@ const GalleryThumbnail = ({
295300 } ,
296301 } ,
297302 } = useTheme ( ) ;
303+ const { t } = useTranslationContext ( ) ;
298304
299305 const openImageViewer = ( ) => {
300306 if ( ! legacyImageViewerSwipeBehaviour && message ) {
@@ -386,6 +392,7 @@ const GalleryThumbnail = ({
386392 borderRadius = { imageBorderRadius ?? borderRadius }
387393 ImageLoadingFailedIndicator = { ImageLoadingFailedIndicator }
388394 ImageLoadingIndicator = { ImageLoadingIndicator }
395+ ImageReloadIndicator = { ImageReloadIndicator }
389396 thumbnail = { thumbnail }
390397 />
391398 </ View >
@@ -400,7 +407,7 @@ const GalleryThumbnail = ({
400407 ] }
401408 >
402409 < Text style = { [ styles . moreImagesText , moreImagesText ] } >
403- { `+ ${ imagesAndVideos . length - 4 } ` }
410+ { String ( t ( '+{{count}}' , { count : imagesAndVideos . length - 4 } ) ) }
404411 </ Text >
405412 </ View >
406413 ) : null }
@@ -412,10 +419,15 @@ const GalleryImageThumbnail = ({
412419 borderRadius,
413420 ImageLoadingFailedIndicator,
414421 ImageLoadingIndicator,
422+ ImageReloadIndicator,
415423 thumbnail,
416424} : Pick <
417425 GalleryThumbnailProps ,
418- 'ImageLoadingFailedIndicator' | 'ImageLoadingIndicator' | 'thumbnail' | 'borderRadius'
426+ | 'ImageLoadingFailedIndicator'
427+ | 'ImageLoadingIndicator'
428+ | 'ImageReloadIndicator'
429+ | 'thumbnail'
430+ | 'borderRadius'
419431> ) => {
420432 const {
421433 isLoadingImage,
@@ -563,6 +575,7 @@ export const Gallery = (props: GalleryProps) => {
563575 hasThreadReplies,
564576 ImageLoadingFailedIndicator : PropImageLoadingFailedIndicator ,
565577 ImageLoadingIndicator : PropImageLoadingIndicator ,
578+ ImageReloadIndicator : PropImageReloadIndicator ,
566579 images : propImages ,
567580 message : propMessage ,
568581 myMessageTheme : propMyMessageTheme ,
@@ -594,6 +607,7 @@ export const Gallery = (props: GalleryProps) => {
594607 additionalPressableProps : contextAdditionalPressableProps ,
595608 ImageLoadingFailedIndicator : ContextImageLoadingFailedIndicator ,
596609 ImageLoadingIndicator : ContextImageLoadingIndicator ,
610+ ImageReloadIndicator : ContextImageReloadIndicator ,
597611 legacyImageViewerSwipeBehaviour,
598612 myMessageTheme : contextMyMessageTheme ,
599613 VideoThumbnail : ContextVideoThumnbnail ,
@@ -623,6 +637,7 @@ export const Gallery = (props: GalleryProps) => {
623637 const ImageLoadingFailedIndicator =
624638 PropImageLoadingFailedIndicator || ContextImageLoadingFailedIndicator ;
625639 const ImageLoadingIndicator = PropImageLoadingIndicator || ContextImageLoadingIndicator ;
640+ const ImageReloadIndicator = PropImageReloadIndicator || ContextImageReloadIndicator ;
626641 const myMessageTheme = propMyMessageTheme || contextMyMessageTheme ;
627642
628643 return (
@@ -635,6 +650,7 @@ export const Gallery = (props: GalleryProps) => {
635650 hasThreadReplies : hasThreadReplies || ! ! message ?. reply_count ,
636651 ImageLoadingFailedIndicator,
637652 ImageLoadingIndicator,
653+ ImageReloadIndicator,
638654 images,
639655 legacyImageViewerSwipeBehaviour,
640656 message,
0 commit comments