Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Libraries/Experimental/SwipeableRow/SwipeableListView.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ const SwipeableListView = React.createClass({
_shouldBounceFirstRowOnMount: false,

propTypes: {
/**
* Auto close any open rows when listview is scrolled
*/
closeOnScroll: PropTypes.bool.isRequired,
/**
* To alert the user that swiping is possible, the first row can bounce
* on component mount.
Expand All @@ -84,6 +88,7 @@ const SwipeableListView = React.createClass({

getDefaultProps(): Object {
return {
closeOnScroll: false,
bounceFirstRowOnMount: false,
renderQuickActions: () => null,
};
Expand Down Expand Up @@ -119,6 +124,7 @@ const SwipeableListView = React.createClass({
dataSource={this.state.dataSource.getDataSource()}
renderRow={this._renderRow}
scrollEnabled={this.state.scrollEnabled}
onScroll={this._onScroll}
/>
);
},
Expand Down Expand Up @@ -182,6 +188,15 @@ const SwipeableListView = React.createClass({
dataSource: this.state.dataSource.setOpenRowID(rowID),
});
},

_onScroll(): void {
if (this.props.closeOnScroll) {
this.setState({
dataSource: this.state.dataSource.setOpenRowID(),
});
}
},

});

module.exports = SwipeableListView;