Skip to content
This repository was archived by the owner on Mar 14, 2020. It is now read-only.

Background image not rendereing from props #3

Closed
alluster opened this issue Feb 6, 2018 · 4 comments
Closed

Background image not rendereing from props #3

alluster opened this issue Feb 6, 2018 · 4 comments

Comments

@alluster
Copy link

alluster commented Feb 6, 2018

Hi, I'm having problems with rendering my BG in the lazy-hero!... can you help me figure ot the reason for this? Thank you!

This is how the browser looks:

image
This is my index where I import my Hero.js:
image

In Hero.js I import lazy-hero
image

Do you have an idea about why the background-image: attribute doesn't show the picture?

@danistefanovic
Copy link
Owner

It looks like that the opacity is not switched from 0 to 1. This happens if the image is not loaded or the hero component is not in the viewport. Are there any errors in the browser console?

@alluster
Copy link
Author

alluster commented Feb 7, 2018

There were warnings about the imageSrc={} supposed to be a string value in initial state in the parent component, which in my case was actually a boolean but changing this did not help. Also changed the opacity from string to a number due some warnings. Now when I console.log(heroImage) in the child component Hero.js right before it's supposed to throw it to the imageSrc={}, console shows that it renders empty few times. This is due my parent component gets the image from source later than the hero actually renders maybe? I'm not sure how to fix this..

@danistefanovic
Copy link
Owner

Can you test it with the newest version ([email protected])?

@alluster
Copy link
Author

alluster commented Feb 8, 2018

Great thanks, works like a charm now!

@alluster alluster closed this as completed Feb 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants