beekai-oss / react-simple-img

🌅 React lazy load images with IntersectionObserver API and Priority Hints
MIT License
989 stars 41 forks source link

not showing img after re-rendering component #92

Closed khanbaba closed 4 years ago

khanbaba commented 4 years ago

I have a product card with an image and two button for like and watch, when i click these buttons the state of component changes, this change calls render function and after that the loaded images are not visible. whats is the problem ?

here is the code in that card for image lazy loading:

<SimpleImg
                    src={product.image_url}
                    style={{
                      display: 'block',
                      margin: 'auto',
                      width: '100%',
                      height: '100%'
                    }}
                    imgStyle={{ objectFit: 'contain', height: '100%' }}
                    alt={product.name1}
                    onError={this.onImageError}
                    importance={'low'}
                    disableAnimateCachedImg={true}
                  />
khanbaba commented 4 years ago

the problem was because of bootstrap which set 'visiblity: hidden' for img.