Skip to content

Placeholder component doesn't show #63

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
LouiseReid opened this issue Apr 21, 2020 · 3 comments · May be fixed by #73
Open

Placeholder component doesn't show #63

LouiseReid opened this issue Apr 21, 2020 · 3 comments · May be fixed by #73

Comments

@LouiseReid
Copy link

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
@tomasztomys
Copy link

+1

@Aljullu Aljullu linked a pull request Jun 20, 2020 that will close this issue
@Aljullu
Copy link
Owner

Aljullu commented Jun 20, 2020

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.

@thuyetlamm
Copy link

thuyetlamm commented Jan 14, 2025

I encountered this problem and this is how I solved it. I find it works very well
<LazyLoadImage src={url} alt={alt} width={'100%'} height={'100%'} delayTime={500} wrapperProps={{ opacity: 0.7, }} wrapperClassName={styles['wrapper']} threshold={90} style={{ width: '100%', height: '100%', objectFit: 'cover', borderRadius: '0.5rem', verticalAlign: 'middle', borderStyle: 'none', ...style, }} effect={'blur'} placeholderSrc={placeholder} {...props} />

For now, you can override that with CSS:
`
span.wrapper[style*="background-image"] {
border-radius: 0.5rem;
animation: fill 0.5s ease-in-out 0.5s forwards;
}

@Keyframes fill {
from {
filter: blur(15px);
}
to {
filter: blur(0px) ;
}
}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants