react-lazy-load-image-component
react-lazy-load-image-component copied to clipboard
Placeholder component doesn't show
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
+1
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
.