Use 'visibleLength' if 'contentLength' is less

Summary: This prevents the 'distanceFromEnd' from being negative when 'offset' is zero, for example.
Closes https://github.com/facebook/react-native/pull/3074

Reviewed By: svcscm

Differential Revision: D2610771

Pulled By: sahrens

fb-gh-sync-id: f878f1c1b865063294013c3bb96b90831877d372
This commit is contained in:
aleclarsoniv 2015-11-03 10:11:51 -08:00 committed by facebook-github-bot-4
parent 2797bc2069
commit 5dd3b88a81
1 changed files with 5 additions and 3 deletions

View File

@ -500,9 +500,11 @@ var ListView = React.createClass({
},
_getDistanceFromEnd: function(scrollProperties) {
return scrollProperties.contentLength -
scrollProperties.visibleLength -
scrollProperties.offset;
var maxLength = Math.max(
scrollProperties.contentLength,
scrollProperties.visibleLength
);
return maxLength - scrollProperties.visibleLength - scrollProperties.offset;
},
_updateVisibleRows: function(updatedFrames) {