Skip to content

Commit 4318d84

Browse files
Brad Bumbaloughgitim
authored andcommitted
Only set pan responder on relevant gestures
- This should allow for child horizontal pan responders (ie swiping).
1 parent 250e35f commit 4318d84

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Row.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,14 @@ export default class Row extends Component {
4646
_panResponder = PanResponder.create({
4747
onStartShouldSetPanResponder: () => !this._isDisabled(),
4848

49-
onMoveShouldSetPanResponder: () => !this._isDisabled(),
49+
onMoveShouldSetPanResponder: (e, gestureState) => {
50+
if (this._isDisabled()) return false;
51+
52+
const vy = Math.abs(gestureState.vy)
53+
const vx = Math.abs(gestureState.vx)
54+
55+
return this._active && (this.props.horizontal ? vx > vy : vy > vx);
56+
},
5057

5158
onShouldBlockNativeResponder: () => {
5259
// Returns whether this component should block native components from becoming the JS

0 commit comments

Comments
 (0)