Skip to content

Commit

Permalink
[RFC][ScrollView] Add getScrollResponder to ScrollView for composition
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ide committed Apr 14, 2015
1 parent c412585 commit 6286480
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Libraries/Components/ScrollView/ScrollView.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,16 @@ var ScrollView = React.createClass({
this.refs[SCROLLVIEW].setNativeProps(props);
},

/**
* Returns a reference to the underlying scroll responder, which supports
* operations like `scrollTo`. All ScrollView-like components should
* implement this method so that they can be composed while providing access
* to the underlying scroll responder's methods.
*/
getScrollResponder: function(): ReactComponent {
return this;
},

getInnerViewNode: function(): any {
return this.refs[INNERVIEW].getNodeHandle();
},
Expand Down

0 comments on commit 6286480

Please sign in to comment.