react-lazy-load-image-component icon indicating copy to clipboard operation
react-lazy-load-image-component copied to clipboard

Placeholder component doesn't show

Open LouiseReid opened this issue 4 years ago • 2 comments

Using this code, can you tell me why the placeholder doesn't show? I've attempted using placeholder and placeholderSrc. My expected behaviour would be to see loading text on screen before the image renders

              <LazyLoadImage
                src={image.uri}
                key={index}
                alt={`${title}`}
                onClick={() => handleImageClick(image.uri)}
                effect="blur"
                placeholderSrc={<h1>loading...</h1>}
                placeholder={<h1>test</h1>}
              />

Technical details:

  • Package version ^1.4.3
  • Server Side Rendering? no
  • Device desktop
  • Operating System Mac OS
  • Browser Chrome

LouiseReid avatar Apr 21 '20 14:04 LouiseReid

+1

tomasztomys avatar Jun 17 '20 10:06 tomasztomys

Right... that's because we set the text color to transparent. I created a PR to remove it (#73), but will need some more testing before being able to release.

For now, you can override that with CSS:

.lazy-load-image-background {
  color: inherit !important;
}

Btw, from the code above: placeholderSrc only accepts a string, which should be the src of the placeholder. If you want to render an element or a component, you only need to use placeholder.

Aljullu avatar Jun 20 '20 16:06 Aljullu