Skip to content

Commit a7ea653

Browse files
author
Davide Curletti
committed
Fixes incorrect transpile and version
1 parent 50b8548 commit a7ea653

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

lib/ReduxInfiniteScroll.js

+14-11
Original file line numberDiff line numberDiff line change
@@ -88,21 +88,16 @@ var ReduxInfiniteScroll = function (_Component) {
8888
}, {
8989
key: 'scrollListener',
9090
value: function scrollListener() {
91-
var _this2 = this;
92-
9391
// This is to prevent the upcoming logic from toggling a load more before
9492
// any data has been passed to the component
95-
if (this.props.items <= 0) return;
93+
if (this._totalItemsSize() <= 0) return;
9694

97-
// Need to find better way around this setTimeout
98-
setTimeout(function () {
99-
var bottomPosition = _this2.props.elementIsScrollable ? _this2._elScrollListener() : _this2._windowScrollListener();
95+
var bottomPosition = this.props.elementIsScrollable ? this._elScrollListener() : this._windowScrollListener();
10096

101-
if (bottomPosition < Number(_this2.props.threshold)) {
102-
_this2.detachScrollListener();
103-
_this2.props.loadMore();
104-
}
105-
});
97+
if (bottomPosition < Number(this.props.threshold)) {
98+
this.detachScrollListener();
99+
this.props.loadMore();
100+
}
106101
}
107102
}, {
108103
key: 'detachScrollListener',
@@ -118,6 +113,14 @@ var ReduxInfiniteScroll = function (_Component) {
118113

119114
return [allItems, this.renderLoader()];
120115
}
116+
}, {
117+
key: '_totalItemsSize',
118+
value: function _totalItemsSize() {
119+
var totalSize = void 0;
120+
totalSize += this.props.children.size ? this.props.children.size : this.props.children.length;
121+
totalSize += this.props.items.size ? this.props.items.size : this.props.items.length;
122+
return totalSize;
123+
}
121124
}, {
122125
key: 'componentWillUnmount',
123126
value: function componentWillUnmount() {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "redux-infinite-scroll",
3-
"version": "1.1.1",
3+
"version": "1.0.6",
44
"description": "React infinite scroll component designed for a Redux data-flow.",
55
"main": "lib/ReduxInfiniteScroll.js",
66
"scripts": {

0 commit comments

Comments
 (0)