From 28d4e1af0f6c48bfd88aa8ea4033bdcd3759c015 Mon Sep 17 00:00:00 2001 From: James Ide Date: Wed, 8 Apr 2015 23:47:40 -0700 Subject: [PATCH] [RFC][ListView] Add getInnerViewNode, scrollTo, scrollWithoutAnimationTo After building some scroll view components (pull-to-refresh, infinite scroll) one of the most important features I found was composition of different scroll views. This diff adds scroll view methods to ListView so that it too acts like a scroll view and can be composed. This is an RFC because I have another approach that is a little more robust but perhaps more obtuse. --- Libraries/CustomComponents/ListView/ListView.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Libraries/CustomComponents/ListView/ListView.js b/Libraries/CustomComponents/ListView/ListView.js index 3fdb980b54b83b..37c7958d89ad86 100644 --- a/Libraries/CustomComponents/ListView/ListView.js +++ b/Libraries/CustomComponents/ListView/ListView.js @@ -198,9 +198,23 @@ var ListView = React.createClass({ }; }, + getInnerViewNode: function() { + return this.refs[SCROLLVIEW_REF].getInnerViewNode(); + }, + + scrollTo: function(destY, destX) { + this.refs[SCROLLVIEW_REF].scrollTo(destY, destX); + }, + + scrollWithoutAnimationTo: function(destY, destX) { + this.refs[SCROLLVIEW_REF].scrollWithoutAnimationTo(destY, destX); + }, + /** * Provides a handle to the underlying scroll responder to support operations * such as scrollTo. + * + * Deprecated: instead call scrollTo, etc. directly on this component */ getScrollResponder: function() { return this.refs[SCROLLVIEW_REF];