Skip to content
This repository has been archived by the owner on Jun 10, 2020. It is now read-only.

Commit

Permalink
Allow for changing container height.
Browse files Browse the repository at this point in the history
  • Loading branch information
garetht committed Oct 30, 2014
1 parent 3b5bf58 commit 9c6c39e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
11 changes: 7 additions & 4 deletions dist/react-infinite.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/react-infinite.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions src/react-infinite.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,22 @@
},

componentWillReceiveProps: function(nextProps) {
var newStateObject = {};
var that = this,
newStateObject = {};

if (nextProps.isInfiniteLoading !== undefined) {
newStateObject.isInfiniteLoading = nextProps.isInfiniteLoading;
}

var nextPBS = nextProps.preloadBatchSize;
newStateObject.preloadBatchSize = nextPBS ? nextPBS : this.props.containerHeight / 2;
newStateObject.preloadBatchSize = nextPBS ? nextPBS : nextProps.containerHeight / 2;

var nextPAH = nextProps.preloadAdditionalHeight;
newStateObject.preloadAdditionalHeight = nextPAH ? nextPAH : this.props.containerHeight;
newStateObject.preloadAdditionalHeight = nextPAH ? nextPAH : nextProps.containerHeight;

this.setState(newStateObject);
this.setState(newStateObject, function() {
that.setStateFromScrollTop(that.getScrollTop());
});
},

componentDidUpdate: function(prevProps, prevState) {
Expand Down

0 comments on commit 9c6c39e

Please sign in to comment.