Skip to content

Commit f7ee0a7

Browse files
Merge pull request #315 from ameerthehacker/fix/finddomnode-compatability
2 parents fb8160d + a8b8f3e commit f7ee0a7

File tree

5 files changed

+12
-4
lines changed

5 files changed

+12
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules/
22
coverage/
33
.DS_Store
4+
.idea

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ Lazyload your Components, Images or anything matters the performance.
2525
## Installation
2626

2727
> 2.0.0 is finally out, read [Upgrade Guide](https://github.com/twobin/react-lazyload/wiki/Upgrade-Guide), it's almost painless to upgrade!
28+
> 3.0.0 fixes the findDomNode warning through usage of React ref, and the following are the changes you need to be aware of
29+
30+
* Now we have an extra div wrapping the lazy loaded component for the React ref to work
31+
* We can understand that it is an extra DOM node, and we are working to optimize that if possible
32+
* It might break your UI or snapshot tests based on your usage
33+
* To customize the styling to the extra div please refer [here](#classNamePrefix)
34+
* Found any other problem, please feel free to leave a comment over [here](https://github.com/twobin/react-lazyload/issues/310)
2835

2936
```
3037
$ npm install --save react-lazyload

lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ var LazyLoad = function (_Component) {
358358

359359

360360
return _react2.default.createElement(
361-
'span',
361+
'div',
362362
{ className: classNamePrefix + '-wrapper', ref: this.setRef },
363363
this.visible ? children : placeholder ? placeholder : _react2.default.createElement('div', {
364364
style: { height: height },

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-lazyload",
3-
"version": "2.6.8",
3+
"version": "3.0.0",
44
"description": "Lazyload your components, images or anything where performance matters.",
55
"main": "lib/index.js",
66
"scripts": {

src/index.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ class LazyLoad extends Component {
337337
} = this.props;
338338

339339
return (
340-
<span className={`${classNamePrefix}-wrapper`} ref={this.setRef}>
340+
<div className={`${classNamePrefix}-wrapper`} ref={this.setRef}>
341341
{this.visible ? (
342342
children
343343
) : placeholder ? (
@@ -348,7 +348,7 @@ class LazyLoad extends Component {
348348
className={`${classNamePrefix}-placeholder`}
349349
/>
350350
)}
351-
</span>
351+
</div>
352352
);
353353
}
354354
}

0 commit comments

Comments
 (0)