Skip to content

Commit 0f94a8d

Browse files
committed
Introduce rowActivationTime prop
1 parent 70fbbc1 commit 0f94a8d

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/Row.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import React, {Component, PropTypes} from 'react';
22
import {Animated, PanResponder, StyleSheet} from 'react-native';
33
import {shallowEqual} from './utils';
44

5-
const ACTIVATION_DELAY = 200;
6-
75
export default class Row extends Component {
86
static propTypes = {
97
children: PropTypes.node,
@@ -15,6 +13,7 @@ export default class Row extends Component {
1513
x: PropTypes.number,
1614
y: PropTypes.number,
1715
}),
16+
activationTime: PropTypes.number,
1817

1918
// Will be called on long press.
2019
onActivate: PropTypes.func,
@@ -30,6 +29,7 @@ export default class Row extends Component {
3029

3130
static defaultProps = {
3231
location: {x: 0, y: 0},
32+
activationTime: 200,
3333
};
3434

3535
constructor(props) {
@@ -66,7 +66,7 @@ export default class Row extends Component {
6666
moveY: gestureState.y0,
6767
};
6868
this._toggleActive(e, gestureState);
69-
}, ACTIVATION_DELAY);
69+
}, this.props.activationTime);
7070
},
7171

7272
onPanResponderMove: (e, gestureState) => {

src/SortableList.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@ export default class SortableList extends Component {
2222
scrollEnabled: PropTypes.bool,
2323
horizontal: PropTypes.bool,
2424
refreshControl: PropTypes.element,
25+
autoscrollAreaSize: PropTypes.number,
26+
rowActivationTime: PropTypes.number,
2527

2628
renderRow: PropTypes.func.isRequired,
2729
renderFooter: PropTypes.func,
2830

2931
onChangeOrder: PropTypes.func,
3032
onActivateRow: PropTypes.func,
3133
onReleaseRow: PropTypes.func,
32-
autoscrollAreaSize: PropTypes.number,
3334
};
3435

3536
static defaultProps = {
@@ -186,7 +187,7 @@ export default class SortableList extends Component {
186187
}
187188

188189
_renderRows() {
189-
const {horizontal, sortingEnabled, renderRow} = this.props;
190+
const {horizontal, rowActivationTime, sortingEnabled, renderRow} = this.props;
190191
const {animated, order, data, activeRowKey, releasedRowKey, rowsLayouts} = this.state;
191192

192193
let rowHeight = 0;
@@ -233,6 +234,7 @@ export default class SortableList extends Component {
233234
key={uniqueRowKey(key)}
234235
ref={this._onRefRow.bind(this, key)}
235236
horizontal={horizontal}
237+
activationTime={rowActivationTime}
236238
animated={animated && !active}
237239
disabled={!sortingEnabled}
238240
style={style}

0 commit comments

Comments
 (0)