react-infinite-scroll-container
Advanced tools
Comparing version 1.0.7 to 1.0.8
@@ -35,2 +35,3 @@ 'use strict'; | ||
_this.attachedScroller = false; | ||
_this.scrollListener = _this.scrollListener.bind(_this); | ||
@@ -44,3 +45,3 @@ return _this; | ||
this.pageLoaded = this.props.pageStart; | ||
this.attachScrollListener(); | ||
if (this.props.hasMore) this.attachScrollListener(); | ||
if (this.props.initialLoad) { | ||
@@ -58,3 +59,6 @@ this.props.loadMore(this.pageLoaded); | ||
} | ||
if (nextProps.resetPageLoader && !this.props.resetPageLoader) this.pageLoaded = this.props.pageStart; | ||
if (nextProps.resetPageLoader && !this.props.resetPageLoader) { | ||
this.attachScrollListener(); | ||
this.pageLoaded = this.props.pageStart; | ||
} | ||
} | ||
@@ -75,3 +79,4 @@ }, { | ||
totalItemsCount = _props.totalItemsCount, | ||
props = _objectWithoutProperties(_props, ['children', 'element', 'hasMore', 'initialLoad', 'loader', 'loadMore', 'pageStart', 'threshold', 'useWindow', 'totalItemsCount']); | ||
resetPageLoader = _props.resetPageLoader, | ||
props = _objectWithoutProperties(_props, ['children', 'element', 'hasMore', 'initialLoad', 'loader', 'loadMore', 'pageStart', 'threshold', 'useWindow', 'totalItemsCount', 'resetPageLoader']); | ||
@@ -113,6 +118,5 @@ return _react2.default.createElement(element, props, children, hasMore && (loader || this._defaultLoader)); | ||
value: function attachScrollListener() { | ||
if (!this.props.hasMore && !this.props.resetPageLoader) { | ||
return; | ||
} | ||
if (this.attachedScroller) return; | ||
this.attachedScroller = true; | ||
var scrollEl = window; | ||
@@ -133,3 +137,3 @@ if (this.props.useWindow == false) { | ||
} | ||
this.attachedScroller = false; | ||
scrollEl.removeEventListener('scroll', this.scrollListener); | ||
@@ -136,0 +140,0 @@ scrollEl.removeEventListener('resize', this.scrollListener); |
{ | ||
"name": "react-infinite-scroll-container", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "Infinite scroll component for React in ES6", | ||
@@ -5,0 +5,0 @@ "main": "dist/InfiniteScroll.js", |
@@ -28,2 +28,3 @@ import React, { Component, PropTypes } from 'react'; | ||
super(props); | ||
this.attachedScroller = false; | ||
this.scrollListener = this.scrollListener.bind(this); | ||
@@ -34,3 +35,3 @@ } | ||
this.pageLoaded = this.props.pageStart; | ||
this.attachScrollListener(); | ||
if(this.props.hasMore) this.attachScrollListener(); | ||
if (this.props.initialLoad) { | ||
@@ -47,3 +48,6 @@ this.props.loadMore(this.pageLoaded); | ||
} | ||
if (nextProps.resetPageLoader && !this.props.resetPageLoader) this.pageLoaded = this.props.pageStart; | ||
if (nextProps.resetPageLoader && !this.props.resetPageLoader ) { | ||
this.attachScrollListener(); | ||
this.pageLoaded = this.props.pageStart; | ||
} | ||
} | ||
@@ -63,2 +67,3 @@ | ||
totalItemsCount, | ||
resetPageLoader, | ||
...props | ||
@@ -99,6 +104,5 @@ } = this.props; | ||
attachScrollListener() { | ||
if(!this.props.hasMore && !this.props.resetPageLoader) { | ||
return; | ||
} | ||
if (this.attachedScroller) return | ||
this.attachedScroller = true; | ||
let scrollEl = window; | ||
@@ -118,3 +122,3 @@ if(this.props.useWindow == false) { | ||
} | ||
this.attachedScroller = false; | ||
scrollEl.removeEventListener('scroll', this.scrollListener); | ||
@@ -121,0 +125,0 @@ scrollEl.removeEventListener('resize', this.scrollListener); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
769890
19478
91