Pass along scrollResponder()

Summary: Allows calls to `scrollResponder()` without crashing

Reviewed By: fkgozali

Differential Revision: D3293272

fbshipit-source-id: c46d99c0d7430a37fc364fa3aaf77dd192d7ab37
This commit is contained in:
Fred Liu 2016-05-12 11:48:39 -07:00 committed by Facebook Github Bot 5
parent 2c3ca4c058
commit 853074d1ee

View File

@ -46,6 +46,8 @@ const SwipeableListView = React.createClass({
},
},
_listViewRef: (null: ?string),
propTypes: {
dataSource: PropTypes.object.isRequired, // SwipeableListViewDataSource
maxSwipeDistance: PropTypes.number,
@ -79,12 +81,22 @@ const SwipeableListView = React.createClass({
return (
<ListView
{...this.props}
ref={(ref) => {
this._listViewRef = ref;
}}
dataSource={this.state.dataSource}
renderRow={this._renderRow}
/>
);
},
// Passing through ListView's getScrollResponder() function
getScrollResponder(): ?Object {
if (this._listViewRef && this._listViewRef.getScrollResponder) {
return this._listViewRef.getScrollResponder();
}
},
_renderRow(rowData: Object, sectionID: string, rowID: string): ReactElement {
const slideoutView = this.props.renderQuickActions(rowData, sectionID, rowID);