react-lazyload
Advanced tools
Comparing version
@@ -206,2 +206,10 @@ /** | ||
LazyLoad.prototype.render = function render() { | ||
/** | ||
* For components like images, they shouldn't be rendered until it appears | ||
* in the viewport. | ||
*/ | ||
if (this.props.once && !this.state.visible) { | ||
return null; | ||
} | ||
return _react2['default'].cloneElement(this.props.children, { | ||
@@ -208,0 +216,0 @@ visible: this.state.visible, |
{ | ||
"name": "react-lazyload", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "Lazyload your Component, Image or anything matters the performance.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -7,2 +7,4 @@ # react-lazyload [](http://badge.fury.io/js/react-lazyload) | ||
> 2.0.0-beta is out, try it out [here](https://github.com/jasonslyvia/react-lazyload/tree/2.0.0-beta2) | ||
## Why it's better | ||
@@ -9,0 +11,0 @@ |
@@ -191,2 +191,10 @@ /** | ||
render() { | ||
/** | ||
* For components like images, they shouldn't be rendered until it appears | ||
* in the viewport. | ||
*/ | ||
if (this.props.once && !this.state.visible) { | ||
return null; | ||
} | ||
return React.cloneElement(this.props.children, { | ||
@@ -193,0 +201,0 @@ visible: this.state.visible, |
27869
1.8%618
2.32%137
1.48%