Skip to content

Commit 5bc45f1

Browse files
olinotteghemfacebook-github-bot-4
authored andcommitted
improve navigation and tail fetch logging
Reviewed By: nspaun Differential Revision: D2791366 fb-gh-sync-id: 5cacc34ef29630437e82b1fab18c928c8794d551
1 parent 8cabdba commit 5bc45f1

1 file changed

Lines changed: 14 additions & 22 deletions

File tree

Libraries/CustomComponents/ListView/ListView.js

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ var TimerMixin = require('react-timer-mixin');
3737
var isEmpty = require('isEmpty');
3838
var logError = require('logError');
3939
var merge = require('merge');
40-
var shallowEqual = require('shallowEqual');
4140

4241
var PropTypes = React.PropTypes;
4342

@@ -268,7 +267,6 @@ var ListView = React.createClass({
268267
this._visibleRows = {};
269268
this._prevRenderedRowsCount = 0;
270269
this._sentEndForContentLength = null;
271-
this._lastScrollPropertiesCheckedForPaging = null;
272270
},
273271

274272
componentDidMount: function() {
@@ -435,24 +433,24 @@ var ListView = React.createClass({
435433
},
436434

437435
_onContentSizeChange: function(width, height) {
438-
this.scrollProperties.contentLength = !this.props.horizontal ?
439-
height : width;
440-
this._updateVisibleRows();
441-
this._renderMoreRowsIfNeeded();
442-
if (this.props.onContentSizeChange) {
443-
this.props.onContentSizeChange(width, height);
436+
var contentLength = !this.props.horizontal ? height : width;
437+
if (contentLength !== this.scrollProperties.contentLength) {
438+
this.scrollProperties.contentLength = contentLength;
439+
this._updateVisibleRows();
440+
this._renderMoreRowsIfNeeded();
444441
}
442+
this.props.onContentSizeChange && this.props.onContentSizeChange(width, height);
445443
},
446444

447445
_onLayout: function(event) {
448446
var {width, height} = event.nativeEvent.layout;
449-
this.scrollProperties.visibleLength = !this.props.horizontal ?
450-
height : width;
451-
this._updateVisibleRows();
452-
this._renderMoreRowsIfNeeded();
453-
if (this.props.onLayout) {
454-
this.props.onLayout(event);
455-
}
447+
var visibleLength = !this.props.horizontal ? height : width;
448+
if (visibleLength !== this.scrollProperties.visibleLength) {
449+
this.scrollProperties.visibleLength = visibleLength;
450+
this._updateVisibleRows();
451+
this._renderMoreRowsIfNeeded();
452+
}
453+
this.props.onLayout && this.props.onLayout(event);
456454
},
457455

458456
_maybeCallOnEndReached: function(event) {
@@ -474,13 +472,7 @@ var ListView = React.createClass({
474472
this._maybeCallOnEndReached();
475473
return;
476474
}
477-
478-
if (shallowEqual(this._lastScrollPropertiesCheckedForPaging, this.scrollProperties)) {
479-
// distance from end of feed hasn't changed since last check, avoid paging twice..
480-
return;
481-
}
482-
this._lastScrollPropertiesCheckedForPaging = {...this.scrollProperties};
483-
475+
484476
var distanceFromEnd = this._getDistanceFromEnd(this.scrollProperties);
485477
if (distanceFromEnd < this.props.scrollRenderAheadDistance) {
486478
this._pageInNewRows();

0 commit comments

Comments
 (0)