Skip to content

Commit 462cdbc

Browse files
author
rt2zz
committed
fix conflict between pans and taps
1 parent bcb9b47 commit 462cdbc

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

index.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ var drawer = React.createClass({
1313
_panning: false,
1414
_tweenPending: false,
1515
_lastPress: 0,
16+
_panStartTime: 0,
1617
_syncAfterUpdate: false,
1718

1819
propTypes: {
@@ -252,13 +253,11 @@ var drawer = React.createClass({
252253
}
253254
},
254255

255-
handleStartShouldSetPanResponder: function(e, gestureState) {
256+
handleStartShouldSetPanResponder (e, gestureState) {
257+
this._panStartTime = Date.now()
256258
if(!this.testPanResponderMask(e, gestureState)){
257259
return false
258260
}
259-
260-
this.processTapGestures()
261-
262261
return true
263262
},
264263

@@ -354,12 +353,12 @@ var drawer = React.createClass({
354353
this._open ? this.close() : this.open()
355354
},
356355

357-
handlePanResponderEnd: function(e: Object, gestureState: Object) {
358-
//Do nothing if we are not in an active pan state
356+
handlePanResponderEnd (e, gestureState) {
357+
// If pan start was > 250ms ago, assume this is a pan not a tap
358+
if (Date.now() - this._panStartTime < 250) this.processTapGestures()
359+
360+
// Do nothing if we are not in an active pan state
359361
if(!this._panning){ return }
360-
//@TODO:Reevaluate - If we are panning the wrong way when the pan ends,
361-
// which animation should trigger?
362-
// if(this._open ^ gestureState.dx < 0){ return }
363362

364363
var absRelMoveX = this.props.side === 'left'
365364
? this._open ? this.state.viewport.width - gestureState.moveX : gestureState.moveX

0 commit comments

Comments
 (0)