@@ -59,7 +59,6 @@ export type GalleryPropsWithContext = Pick<ImageGalleryContextValue, 'imageGalle
5959 | 'VideoThumbnail'
6060 | 'ImageLoadingIndicator'
6161 | 'ImageLoadingFailedIndicator'
62- | 'ImageReloadIndicator'
6362 | 'myMessageTheme'
6463 > &
6564 Pick < OverlayContextValue , 'setOverlay' > & {
@@ -74,7 +73,6 @@ const GalleryWithContext = (props: GalleryPropsWithContext) => {
7473 imageGalleryStateStore,
7574 ImageLoadingFailedIndicator,
7675 ImageLoadingIndicator,
77- ImageReloadIndicator,
7876 images,
7977 message,
8078 onLongPress,
@@ -148,8 +146,8 @@ const GalleryWithContext = (props: GalleryPropsWithContext) => {
148146 images . length !== 1
149147 ? { width : gridWidth , height : gridHeight }
150148 : {
151- height,
152- width,
149+ minHeight : height ,
150+ minWidth : width ,
153151 } ,
154152 galleryContainer ,
155153 ] }
@@ -194,7 +192,6 @@ const GalleryWithContext = (props: GalleryPropsWithContext) => {
194192 imageGalleryStateStore = { imageGalleryStateStore }
195193 ImageLoadingFailedIndicator = { ImageLoadingFailedIndicator }
196194 ImageLoadingIndicator = { ImageLoadingIndicator }
197- ImageReloadIndicator = { ImageReloadIndicator }
198195 imagesAndVideos = { imagesAndVideos }
199196 invertedDirections = { invertedDirections || false }
200197 key = { rowIndex }
@@ -235,7 +232,6 @@ type GalleryThumbnailProps = {
235232 | 'VideoThumbnail'
236233 | 'ImageLoadingIndicator'
237234 | 'ImageLoadingFailedIndicator'
238- | 'ImageReloadIndicator'
239235> &
240236 Pick < ImageGalleryContextValue , 'imageGalleryStateStore' > &
241237 Pick < MessageContextValue , 'onLongPress' | 'onPress' | 'onPressIn' | 'preventPress' > &
@@ -248,7 +244,6 @@ const GalleryThumbnail = ({
248244 imageGalleryStateStore,
249245 ImageLoadingFailedIndicator,
250246 ImageLoadingIndicator,
251- ImageReloadIndicator,
252247 imagesAndVideos,
253248 invertedDirections,
254249 message,
@@ -352,7 +347,6 @@ const GalleryThumbnail = ({
352347 borderRadius = { imageBorderRadius ?? borderRadius }
353348 ImageLoadingFailedIndicator = { ImageLoadingFailedIndicator }
354349 ImageLoadingIndicator = { ImageLoadingIndicator }
355- ImageReloadIndicator = { ImageReloadIndicator }
356350 thumbnail = { thumbnail }
357351 />
358352 ) }
@@ -379,15 +373,10 @@ const GalleryImageThumbnail = ({
379373 borderRadius,
380374 ImageLoadingFailedIndicator,
381375 ImageLoadingIndicator,
382- ImageReloadIndicator,
383376 thumbnail,
384377} : Pick <
385378 GalleryThumbnailProps ,
386- | 'ImageLoadingFailedIndicator'
387- | 'ImageLoadingIndicator'
388- | 'ImageReloadIndicator'
389- | 'thumbnail'
390- | 'borderRadius'
379+ 'ImageLoadingFailedIndicator' | 'ImageLoadingIndicator' | 'thumbnail' | 'borderRadius'
391380> ) => {
392381 const {
393382 isLoadingImage,
@@ -406,15 +395,9 @@ const GalleryImageThumbnail = ({
406395 const styles = useStyles ( ) ;
407396
408397 return (
409- < View style = { styles . image } >
398+ < View style = { [ styles . image , borderRadius ] } >
410399 { isLoadingImageError ? (
411- < >
412- < ImageLoadingFailedIndicator style = { styles . imageLoadingErrorIndicatorStyle } />
413- < ImageReloadIndicator
414- onReloadImage = { onReloadImage }
415- style = { styles . imageReloadContainerStyle }
416- />
417- </ >
400+ < ImageLoadingFailedIndicator onReloadImage = { onReloadImage } />
418401 ) : (
419402 < >
420403 < GalleryImage
@@ -426,14 +409,10 @@ const GalleryImageThumbnail = ({
426409 onLoadEnd = { ( ) => setTimeout ( ( ) => setLoadingImage ( false ) , 0 ) }
427410 onLoadStart = { ( ) => setLoadingImage ( true ) }
428411 resizeMode = { thumbnail . resizeMode }
429- style = { [ borderRadius , gallery . image ] }
412+ style = { gallery . image }
430413 uri = { thumbnail . url }
431414 />
432- { isLoadingImage && (
433- < View style = { styles . imageLoadingIndicatorContainer } >
434- < ImageLoadingIndicator style = { styles . imageLoadingIndicatorStyle } />
435- </ View >
436- ) }
415+ { isLoadingImage ? < ImageLoadingIndicator /> : null }
437416 </ >
438417 ) }
439418 </ View >
@@ -512,7 +491,6 @@ export const Gallery = (props: GalleryProps) => {
512491 additionalPressableProps : propAdditionalPressableProps ,
513492 ImageLoadingFailedIndicator : PropImageLoadingFailedIndicator ,
514493 ImageLoadingIndicator : PropImageLoadingIndicator ,
515- ImageReloadIndicator : PropImageReloadIndicator ,
516494 images : propImages ,
517495 message : propMessage ,
518496 myMessageTheme : propMyMessageTheme ,
@@ -542,7 +520,6 @@ export const Gallery = (props: GalleryProps) => {
542520 additionalPressableProps : contextAdditionalPressableProps ,
543521 ImageLoadingFailedIndicator : ContextImageLoadingFailedIndicator ,
544522 ImageLoadingIndicator : ContextImageLoadingIndicator ,
545- ImageReloadIndicator : ContextImageReloadIndicator ,
546523 myMessageTheme : contextMyMessageTheme ,
547524 VideoThumbnail : ContextVideoThumnbnail ,
548525 } = useMessagesContext ( ) ;
@@ -567,7 +544,6 @@ export const Gallery = (props: GalleryProps) => {
567544 const ImageLoadingFailedIndicator =
568545 PropImageLoadingFailedIndicator || ContextImageLoadingFailedIndicator ;
569546 const ImageLoadingIndicator = PropImageLoadingIndicator || ContextImageLoadingIndicator ;
570- const ImageReloadIndicator = PropImageReloadIndicator || ContextImageReloadIndicator ;
571547 const myMessageTheme = propMyMessageTheme || contextMyMessageTheme ;
572548 const messageContentOrder = propMessageContentOrder || contextMessageContentOrder ;
573549
@@ -585,7 +561,6 @@ export const Gallery = (props: GalleryProps) => {
585561 imageGalleryStateStore,
586562 ImageLoadingFailedIndicator,
587563 ImageLoadingIndicator,
588- ImageReloadIndicator,
589564 images,
590565 message,
591566 myMessageTheme,
@@ -607,6 +582,7 @@ const useStyles = () => {
607582 const {
608583 theme : { semantics } ,
609584 } = useTheme ( ) ;
585+ const { isMyMessage } = useMessageContext ( ) ;
610586 return useMemo ( ( ) => {
611587 return StyleSheet . create ( {
612588 errorTextSize : {
@@ -626,11 +602,15 @@ const useStyles = () => {
626602 imageContainer : { } ,
627603 image : {
628604 flex : 1 ,
605+ backgroundColor : isMyMessage
606+ ? semantics . chatBgAttachmentOutgoing
607+ : semantics . chatBgAttachmentIncoming ,
608+ overflow : 'hidden' ,
629609 } ,
630610 imageLoadingErrorIndicatorStyle : {
631- bottom : 4 ,
632- left : 4 ,
633- position : 'absolute ' ,
611+ ... StyleSheet . absoluteFillObject ,
612+ alignItems : 'center' ,
613+ justifyContent : 'center ' ,
634614 } ,
635615 imageLoadingIndicatorContainer : {
636616 height : '100%' ,
@@ -658,8 +638,17 @@ const useStyles = () => {
658638 lineHeight : primitives . typographyLineHeightRelaxed ,
659639 fontWeight : primitives . typographyFontWeightSemiBold ,
660640 } ,
641+ imageLoadingErrorContainer : {
642+ ...StyleSheet . absoluteFillObject ,
643+ alignItems : 'center' ,
644+ justifyContent : 'center' ,
645+ } ,
646+ imageLoadingErrorWrapper : {
647+ ...StyleSheet . absoluteFillObject ,
648+ overflow : 'hidden' ,
649+ } ,
661650 } ) ;
662- } , [ semantics ] ) ;
651+ } , [ semantics , isMyMessage ] ) ;
663652} ;
664653
665654Gallery . displayName = 'Gallery{messageSimple{gallery}}' ;
0 commit comments