diff --git a/packages/react-events/src/Press.js b/packages/react-events/src/Press.js index 8c46fd391d273..7a4edb998395b 100644 --- a/packages/react-events/src/Press.js +++ b/packages/react-events/src/Press.js @@ -80,7 +80,7 @@ function dispatchPressInEvents( true, ); } - if (props.onLongPress) { + if (props.onLongPress && !props.longPressCancelsPress) { const longPressEventListener = e => { props.onLongPress(e); if (e.nativeEvent.defaultPrevented) { @@ -110,7 +110,7 @@ function dispatchPressOutEvents( true, ); } - if (props.onPressChange) { + if (props.onPressChange && !props.longPressCancelsPress) { const pressChangeEventListener = () => { props.onPressChange(false); }; @@ -121,6 +121,17 @@ function dispatchPressOutEvents( true, ); } + if (state.isLongPressed && props.onLongPressChange) { + const longPressChangeEventListener = () => { + props.onLongPressChange(false); + }; + context.dispatchEvent( + 'longpresschange', + longPressChangeEventListener, + state.pressTarget, + true, + ); + } } function isAnchorTagElement(eventTarget: EventTarget): boolean {