Skip to content

Commit 6b621a5

Browse files
committed
[Idea: ScrollView] Add getScrollResponder to ScrollView for composition
Summary: This is a proposal to add `getScrollResponder` to all ScrollView-like components, including ListView. This allows multiple higher-order scroll views to be composed while allowing the owner of the top-level scroll view to call `scrollableView.getScrollResponder().scrollTo(...)` regardless of whether `scrollableView` is a ScrollView, ListView, InvertedScrollView, etc. Closes facebook#766 Github Author: James Ide <ide@jameside.com> Test Plan: Imported from GitHub, without a `Test Plan:` line.
1 parent 2a7adfb commit 6b621a5

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

Libraries/Components/ScrollView/ScrollView.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,16 @@ var ScrollView = React.createClass({
200200
this.refs[SCROLLVIEW].setNativeProps(props);
201201
},
202202

203+
/**
204+
* Returns a reference to the underlying scroll responder, which supports
205+
* operations like `scrollTo`. All ScrollView-like components should
206+
* implement this method so that they can be composed while providing access
207+
* to the underlying scroll responder's methods.
208+
*/
209+
getScrollResponder: function(): ReactComponent {
210+
return this;
211+
},
212+
203213
getInnerViewNode: function(): any {
204214
return React.findNodeHandle(this.refs[INNERVIEW]);
205215
},

0 commit comments

Comments
 (0)