From 6b2d87c8d0296c18d7c9142896fe41c617e30c8a Mon Sep 17 00:00:00 2001 From: Oliver Wilks Date: Fri, 6 Jan 2023 09:40:45 +0000 Subject: [PATCH] Added mapping of gesture event to native --- .../index.native.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/components/PressableWithSecondaryInteraction/index.native.js b/src/components/PressableWithSecondaryInteraction/index.native.js index efb68e52eb79..3b6edfc92198 100644 --- a/src/components/PressableWithSecondaryInteraction/index.native.js +++ b/src/components/PressableWithSecondaryInteraction/index.native.js @@ -21,9 +21,21 @@ const PressableWithSecondaryInteraction = (props) => { if (e.nativeEvent.state !== State.ACTIVE) { return; } + + // Map gesture event to normal Responder event + const { + absoluteX, absoluteY, locationX, locationY, + } = e.nativeEvent; + const mapEvent = { + ...e, + nativeEvent: { + ...e.nativeEvent, pageX: absoluteX, pageY: absoluteY, x: locationX, y: locationY, + }, + }; + e.preventDefault(); HapticFeedback.trigger(); - props.onSecondaryInteraction(e); + props.onSecondaryInteraction(mapEvent); }} >