Skip to content

Commit

Permalink
Fixes incorrect transpile and version
Browse files Browse the repository at this point in the history
  • Loading branch information
Davide Curletti committed Apr 6, 2016
1 parent 50b8548 commit a7ea653
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
25 changes: 14 additions & 11 deletions lib/ReduxInfiniteScroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,21 +88,16 @@ var ReduxInfiniteScroll = function (_Component) {
}, {
key: 'scrollListener',
value: function scrollListener() {
var _this2 = this;

// This is to prevent the upcoming logic from toggling a load more before
// any data has been passed to the component
if (this.props.items <= 0) return;
if (this._totalItemsSize() <= 0) return;

// Need to find better way around this setTimeout
setTimeout(function () {
var bottomPosition = _this2.props.elementIsScrollable ? _this2._elScrollListener() : _this2._windowScrollListener();
var bottomPosition = this.props.elementIsScrollable ? this._elScrollListener() : this._windowScrollListener();

if (bottomPosition < Number(_this2.props.threshold)) {
_this2.detachScrollListener();
_this2.props.loadMore();
}
});
if (bottomPosition < Number(this.props.threshold)) {
this.detachScrollListener();
this.props.loadMore();
}
}
}, {
key: 'detachScrollListener',
Expand All @@ -118,6 +113,14 @@ var ReduxInfiniteScroll = function (_Component) {

return [allItems, this.renderLoader()];
}
}, {
key: '_totalItemsSize',
value: function _totalItemsSize() {
var totalSize = void 0;
totalSize += this.props.children.size ? this.props.children.size : this.props.children.length;
totalSize += this.props.items.size ? this.props.items.size : this.props.items.length;
return totalSize;
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "redux-infinite-scroll",
"version": "1.1.1",
"version": "1.0.6",
"description": "React infinite scroll component designed for a Redux data-flow.",
"main": "lib/ReduxInfiniteScroll.js",
"scripts": {
Expand Down

0 comments on commit a7ea653

Please sign in to comment.