diff --git a/src/ImageGallery.jsx b/src/ImageGallery.jsx index 91c65684..351752b9 100644 --- a/src/ImageGallery.jsx +++ b/src/ImageGallery.jsx @@ -773,6 +773,11 @@ export default class ImageGallery extends React.Component { const renderItem = item.renderItem || this.props.renderItem || this._renderItem.bind(this); + const showItem = !this.props.lazyLoad || alignment || this._lazyLoaded[index]; + if (showItem && this.props.lazyLoad) { + this._lazyLoaded[index] = true; + } + const slide = (
- {renderItem(item)} + {showItem ? renderItem(item) :
}
); - if (this.props.lazyLoad) { - if (alignment || this._lazyLoaded[index]) { - slides.push(slide); - this._lazyLoaded[index] = true; - } - } else { - slides.push(slide); - } + slides.push(slide); let onThumbnailError = this._handleImageError; if (this.props.onThumbnailError) {