Skip to content

Commit 87c4a28

Browse files
committed
Check if the image was already loaded before firing afterLoad
1 parent ab2e6f1 commit 87c4a28

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/components/LazyLoadImage.jsx

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ class LazyLoadImage extends React.Component {
1313
}
1414

1515
onImageLoad() {
16+
if (this.state.loaded) {
17+
return null;
18+
}
19+
1620
return () => {
1721
this.props.afterLoad();
1822

0 commit comments

Comments
 (0)