From a79460e02ba5f7fbdd922adb81aad6e8c6d5bb6a Mon Sep 17 00:00:00 2001 From: ManigandanRaamanathan Date: Thu, 14 May 2020 03:33:51 +0800 Subject: [PATCH] child component onPress event detection Added onPress detection in PanResponder. Initially it wont recognise onPress events within the child contents. --- lib/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index a0aae1f..667d77d 100644 --- a/lib/index.js +++ b/lib/index.js @@ -116,7 +116,12 @@ export default class Gestures extends Component { onStartShouldSetPanResponder: () => true, onPanResponderTerminationRequest: () => true, onMoveShouldSetPanResponderCapture: (event, { dx, dy }) => ( - dx !== 0 && dy !== 0 + (Math.abs(dx) > 1.5 || Math.abs(dy) > 1.5) + // dx !== 0 && dy !== 0 + ), + onMoveShouldSetPanResponder: (event, { dx, dy }) => ( + (Math.abs(dx) > 1.5 || Math.abs(dy) > 1.5) + // dx !== 0 && dy !== 0 ), }); }