From bf705d697e1deed1c6c95640e2fb0120944cf471 Mon Sep 17 00:00:00 2001 From: Himanshu Date: Wed, 16 Nov 2016 11:58:16 +0530 Subject: [PATCH] fix Android onPress --- Components/Widgets/DeckSwiper.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Components/Widgets/DeckSwiper.js b/Components/Widgets/DeckSwiper.js index cdab72246..1ae4d3673 100644 --- a/Components/Widgets/DeckSwiper.js +++ b/Components/Widgets/DeckSwiper.js @@ -107,7 +107,9 @@ export default class CardSwiper extends NativeBaseComponent { componentWillMount() { this._panResponder = PanResponder.create({ onMoveShouldSetResponderCapture: () => true, - onMoveShouldSetPanResponderCapture: () => true, + onMoveShouldSetPanResponderCapture: (evt, gestureState) => { + return Math.abs(gestureState.dx) > 5; + }, onPanResponderGrant: (e, gestureState) => { this.state.pan.setOffset({x: this.state.pan.x._value, y: this.state.pan.y._value}); @@ -117,10 +119,10 @@ export default class CardSwiper extends NativeBaseComponent { onPanResponderMove: (e, gestureState) => { if (gestureState.dx > 20){ - this.props.onSwiping('right'); + this.props.onSwiping('right',gestureState.dx); } else if (gestureState.dx < -20){ - this.props.onSwiping('left'); + this.props.onSwiping('left',gestureState.dx); } let val = Math.abs((gestureState.dx*.0013)); let opa = Math.abs((gestureState.dx*.0022));