Skip to content

Commit bf524ee

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 862d9fb commit bf524ee

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
@@ -190,6 +190,16 @@ var ScrollView = React.createClass({
190190
this.refs[SCROLLVIEW].setNativeProps(props);
191191
},
192192

193+
/**
194+
* Returns a reference to the underlying scroll responder, which supports
195+
* operations like `scrollTo`. All ScrollView-like components should
196+
* implement this method so that they can be composed while providing access
197+
* to the underlying scroll responder's methods.
198+
*/
199+
getScrollResponder: function(): ReactComponent {
200+
return this;
201+
},
202+
193203
getInnerViewNode: function(): any {
194204
return this.refs[INNERVIEW].getNodeHandle();
195205
},

0 commit comments

Comments
 (0)