add animated param in ListView#scrollTo

Summary:
Since scrollTo(x,y,**animated**) params has been introduced, it was not backported to ListView scrollTo method.
Closes https://github.com/facebook/react-native/pull/5661

Reviewed By: svcscm

Differential Revision: D2886049

Pulled By: nicklockwood

fb-gh-sync-id: 016e92beadc7f397be77b8c58dc572119f873556
This commit is contained in:
Gaëtan Renaudeau 2016-02-01 14:52:33 -08:00 committed by facebook-github-bot-5
parent debcac59d0
commit 9506e5afc7
1 changed files with 4 additions and 4 deletions

View File

@ -236,8 +236,8 @@ var ListView = React.createClass({
this.refs[SCROLLVIEW_REF].getScrollResponder(); this.refs[SCROLLVIEW_REF].getScrollResponder();
}, },
scrollTo: function(destY, destX) { scrollTo: function(destY, destX, animated = true) {
this.getScrollResponder().scrollResponderScrollTo(destX || 0, destY || 0); this.getScrollResponder().scrollResponderScrollTo(destX || 0, destY || 0, animated);
}, },
setNativeProps: function(props) { setNativeProps: function(props) {
@ -472,7 +472,7 @@ var ListView = React.createClass({
this.scrollProperties.visibleLength = visibleLength; this.scrollProperties.visibleLength = visibleLength;
this._updateVisibleRows(); this._updateVisibleRows();
this._renderMoreRowsIfNeeded(); this._renderMoreRowsIfNeeded();
} }
this.props.onLayout && this.props.onLayout(event); this.props.onLayout && this.props.onLayout(event);
}, },
@ -495,7 +495,7 @@ var ListView = React.createClass({
this._maybeCallOnEndReached(); this._maybeCallOnEndReached();
return; return;
} }
var distanceFromEnd = this._getDistanceFromEnd(this.scrollProperties); var distanceFromEnd = this._getDistanceFromEnd(this.scrollProperties);
if (distanceFromEnd < this.props.scrollRenderAheadDistance) { if (distanceFromEnd < this.props.scrollRenderAheadDistance) {
this._pageInNewRows(); this._pageInNewRows();