Skip to content

Commit c89f347

Browse files
committed
Add onPressRow prop
1 parent c5c7835 commit c89f347

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ Called when a row was activated (user long tapped).
4343
- **onReleaseRow** (function)<br />
4444
`(key) => void`<br />
4545
Called when the active row was released.
46+
- **onPressRow** (function)<br />
47+
`(key) => void`<br />
48+
Called when a row was pressed.
4649

4750
####Methods
4851
- **scrollBy(dy?, animated?)** scrolls by a given y offset, either immediately or with a smooth animation

src/Row.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export default class Row extends Component {
1818
// Will be called on long press.
1919
onActivate: PropTypes.func,
2020
onLayout: PropTypes.func,
21+
onPress: PropTypes.func,
2122

2223
// Will be called, when user (directly) move the view.
2324
onMove: PropTypes.func,

src/SortableList.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ export default class SortableList extends Component {
199199
location={location}
200200
onLayout={!rowsLayouts ? this._onLayoutRow.bind(this, resolveLayout, key) : null}
201201
onActivate={this._onActivateRow.bind(this, key, index)}
202+
onPress={this._onPressRow.bind(this, key)}
202203
onRelease={this._onReleaseRow.bind(this, key)}
203204
onMove={this._onMoveRow}>
204205
{renderRow({
@@ -440,6 +441,12 @@ export default class SortableList extends Component {
440441
}
441442
};
442443

444+
_onPressRow = (rowKey) => {
445+
if (this.props.onPressRow) {
446+
this.props.onPressRow(rowKey);
447+
}
448+
};
449+
443450
_onReleaseRow = (rowKey) => {
444451
this._stopAutoScroll();
445452
this.setState(({activeRowKey}) => ({

0 commit comments

Comments
 (0)