Skip to content

Commit bc49683

Browse files
committed
[RFC][ScrollView] Add getScrollResponder to ScrollView for composition
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.
1 parent 9ee6cd6 commit bc49683

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Libraries/Components/ScrollView/ScrollView.js

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

209+
/**
210+
* Returns a reference to the underlying scroll responder, which supports
211+
* operations like `scrollTo`. All ScrollView-like components should
212+
* implement this method so that they can be composed while providing access
213+
* to the underlying scroll responder's methods.
214+
*/
215+
getScrollResponder: function(): ReactComponent {
216+
return this;
217+
},
218+
209219
getInnerViewNode: function(): any {
210220
return this.refs[INNERVIEW].getNodeHandle();
211221
},

0 commit comments

Comments
 (0)