Hi Everyone!
I’m having a issue in browser mobile version with the load of the images.
I have a custom component called CustomImage that loads the image with a serie of parameters. When the image is loaded, it add a style with visibility: visible, and opacity: 1
import React, { useEffect, useState } from 'react'
import Image from "@frontity/components/image";
import { calculateSrcSet } from '../utils/images';
const CustomImage = ( { src, srcSet, className, loading = 'lazy', onReadyToShow, ...rest } ) =>
{
const [ style, setStyle ] = useState( { visibility: 'hidden', opacity: 0 } )
const srcUrl = src;
const srcSetSizes = calculateSrcSet( srcSet );
const srcset = srcSetSizes?.map( image => `${ image.url } ${ image.width }px` ).join( ',' )
const onLoadImage = () =>
{
setStyle( { visibility: 'visible', opacity: 1 } )
onReadyToShow && onReadyToShow();
}
return (
<Image src={ srcUrl } style={ style } { ...rest } srcSet={ srcset } loading={ loading } className={ className } onLoad={ onLoadImage } />
)
}
export default CustomImage
When I see this site in my mobile, the first time load ok, but if I refresh the page, I cannot see the images.
If I delete caché and go back to refresh browser, I can see again the images. In desktop I have not this problem. ¿Anyone knows what could happens?
My site: https://esmuybrutal.puigmar.me/
Thanks!!!