diff --git a/Examples/UIExplorer/ListViewGridLayoutExample.js b/Examples/UIExplorer/ListViewGridLayoutExample.js index ac7d56b86..4d8017335 100644 --- a/Examples/UIExplorer/ListViewGridLayoutExample.js +++ b/Examples/UIExplorer/ListViewGridLayoutExample.js @@ -67,6 +67,9 @@ var ListViewGridLayoutExample = React.createClass({ ); diff --git a/Examples/UIExplorer/ListViewPagingExample.js b/Examples/UIExplorer/ListViewPagingExample.js index f6cdcae62..a1406c52f 100644 --- a/Examples/UIExplorer/ListViewPagingExample.js +++ b/Examples/UIExplorer/ListViewPagingExample.js @@ -32,7 +32,6 @@ var { UIManager, } = NativeModules; -var PAGE_SIZE = 4; var THUMB_URLS = [ require('./Thumbnails/like.png'), require('./Thumbnails/dislike.png'), @@ -182,8 +181,8 @@ var ListViewPagingExample = React.createClass({ renderSectionHeader={this.renderSectionHeader} renderRow={this.renderRow} initialListSize={10} - pageSize={PAGE_SIZE} - scrollRenderAheadDistance={2000} + pageSize={4} + scrollRenderAheadDistance={500} /> ); }, diff --git a/Libraries/CustomComponents/ListView/ListView.js b/Libraries/CustomComponents/ListView/ListView.js index 1a9bef47b..c10717b5a 100644 --- a/Libraries/CustomComponents/ListView/ListView.js +++ b/Libraries/CustomComponents/ListView/ListView.js @@ -147,11 +147,15 @@ var ListView = React.createClass({ */ onEndReached: PropTypes.func, /** - * Threshold in pixels for onEndReached. + * Threshold in pixels (virtual, not physical) for calling onEndReached. */ onEndReachedThreshold: PropTypes.number, /** - * Number of rows to render per event loop. + * Number of rows to render per event loop. Note: if your 'rows' are actually + * cells, i.e. they don't span the full width of your view (as in the + * ListViewGridLayoutExample), you should set the pageSize to be a multiple + * of the number of cells per row, otherwise you're likely to see gaps at + * the edge of the ListView as new pages are loaded. */ pageSize: PropTypes.number, /** @@ -512,11 +516,7 @@ var ListView = React.createClass({ }, _getDistanceFromEnd: function(scrollProperties) { - var maxLength = Math.max( - scrollProperties.contentLength, - scrollProperties.visibleLength - ); - return maxLength - scrollProperties.visibleLength - scrollProperties.offset; + return scrollProperties.contentLength - scrollProperties.visibleLength - scrollProperties.offset; }, _updateVisibleRows: function(updatedFrames) {