Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[react-events] Tap: add maximumDistance prop #16689

Merged
merged 1 commit into from
Sep 10, 2019

Conversation

necolas
Copy link
Contributor

@necolas necolas commented Sep 6, 2019

A prop for configuring the maximum distance that the active pointer can move before the tap is cancelled.

Demo: https://codesandbox.io/s/latest-responder-build-rz96j30rp

@sizebot
Copy link

sizebot commented Sep 6, 2019

Details of bundled changes.

Comparing: e11bf42...6141877

react-events

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-events-focus.development.js 0.0% +0.1% 10.91 KB 10.91 KB 2.35 KB 2.36 KB UMD_DEV
react-events-press.development.js 0.0% +0.1% 21.21 KB 21.21 KB 4.96 KB 4.97 KB UMD_DEV
react-events-focus.production.min.js 0.0% 🔺+0.2% 4.09 KB 4.09 KB 1.39 KB 1.39 KB UMD_PROD
react-events-press.production.min.js 0.0% 🔺+0.2% 7.06 KB 7.06 KB 2.63 KB 2.64 KB UMD_PROD
react-events-context-menu.development.js 0.0% +0.2% 2.67 KB 2.67 KB 999 B 1001 B UMD_DEV
react-events-input.development.js 0.0% +0.3% 4.51 KB 4.51 KB 1.44 KB 1.44 KB UMD_DEV
react-events-swipe.development.js 0.0% +0.2% 5.99 KB 5.99 KB 1.62 KB 1.62 KB UMD_DEV
react-events-context-menu.production.min.js 0.0% 🔺+0.4% 1.38 KB 1.38 KB 723 B 726 B UMD_PROD
react-events-input.production.min.js 0.0% 🔺+0.4% 1.83 KB 1.83 KB 976 B 980 B UMD_PROD
react-events-swipe.production.min.js 0.0% 🔺+0.4% 2.43 KB 2.43 KB 1.1 KB 1.1 KB UMD_PROD
ReactEventsTap-dev.js +5.8% +5.5% 15.02 KB 15.89 KB 3.3 KB 3.48 KB FB_WWW_DEV
ReactEventsTap-prod.js 🔺+4.8% 🔺+5.1% 12.22 KB 12.81 KB 2.73 KB 2.87 KB FB_WWW_PROD
react-events-context-menu.development.js 0.0% +0.4% 2.48 KB 2.48 KB 952 B 956 B NODE_DEV
react-events-input.development.js 0.0% +0.2% 4.33 KB 4.33 KB 1.39 KB 1.39 KB NODE_DEV
react-events-swipe.development.js 0.0% +0.2% 5.81 KB 5.81 KB 1.58 KB 1.58 KB NODE_DEV
react-events-context-menu.production.min.js 0.0% 🔺+0.5% 1.19 KB 1.19 KB 663 B 666 B NODE_PROD
react-events-input.production.min.js 0.0% 🔺+0.3% 1.65 KB 1.65 KB 909 B 912 B NODE_PROD
react-events-swipe.production.min.js 0.0% 🔺+0.3% 2.25 KB 2.25 KB 1.04 KB 1.04 KB NODE_PROD
react-events-hover.development.js 0.0% +0.2% 6.99 KB 6.99 KB 1.55 KB 1.55 KB UMD_DEV
react-events-scroll.development.js 0.0% +0.2% 6.29 KB 6.29 KB 1.65 KB 1.65 KB UMD_DEV
react-events-hover.production.min.js 0.0% 🔺+0.3% 3.11 KB 3.11 KB 1.13 KB 1.13 KB UMD_PROD
react-events-scroll.production.min.js 0.0% 🔺+0.3% 2.61 KB 2.61 KB 1.14 KB 1.14 KB UMD_PROD
react-events-hover.development.js 0.0% +0.2% 6.81 KB 6.81 KB 1.5 KB 1.5 KB NODE_DEV
react-events-scroll.development.js 0.0% +0.2% 6.11 KB 6.11 KB 1.6 KB 1.61 KB NODE_DEV
react-events-hover.production.min.js 0.0% 🔺+0.3% 2.93 KB 2.93 KB 1.07 KB 1.07 KB NODE_PROD
react-events-scroll.production.min.js 0.0% 🔺+0.4% 2.43 KB 2.43 KB 1.08 KB 1.09 KB NODE_PROD
react-events-focus.development.js 0.0% +0.2% 10.73 KB 10.73 KB 2.31 KB 2.31 KB NODE_DEV
react-events-press.development.js 0.0% +0.1% 21.02 KB 21.02 KB 4.91 KB 4.92 KB NODE_DEV
react-events-focus.production.min.js 0.0% 🔺+0.3% 3.92 KB 3.92 KB 1.32 KB 1.32 KB NODE_PROD
react-events-press.production.min.js 0.0% 🔺+0.2% 6.88 KB 6.88 KB 2.58 KB 2.58 KB NODE_PROD
react-events-drag.development.js 0.0% +0.2% 5.21 KB 5.21 KB 1.53 KB 1.54 KB UMD_DEV
react-events-keyboard.development.js 0.0% +0.1% 5.53 KB 5.53 KB 1.97 KB 1.97 KB UMD_DEV
react-events-tap.development.js +5.6% +5.6% 15.44 KB 16.31 KB 3.41 KB 3.6 KB UMD_DEV
react-events-drag.production.min.js 0.0% 🔺+0.4% 2.24 KB 2.24 KB 1.06 KB 1.07 KB UMD_PROD
react-events-keyboard.production.min.js 0.0% 🔺+0.2% 2.26 KB 2.26 KB 1.22 KB 1.22 KB UMD_PROD
react-events-tap.production.min.js 🔺+4.3% 🔺+4.8% 5.54 KB 5.78 KB 2.17 KB 2.28 KB UMD_PROD
react-events-drag.development.js 0.0% +0.1% 6.97 KB 6.97 KB 2.2 KB 2.21 KB NODE_DEV
react-events-keyboard.development.js 0.0% +0.1% 5.34 KB 5.34 KB 1.92 KB 1.92 KB NODE_DEV
react-events-tap.development.js +5.1% +4.6% 17.21 KB 18.08 KB 4.05 KB 4.24 KB NODE_DEV
react-events-drag.production.min.js 0.0% 🔺+0.1% 2.87 KB 2.87 KB 1.37 KB 1.37 KB NODE_PROD
react-events-keyboard.production.min.js 0.0% 🔺+0.1% 2.08 KB 2.08 KB 1.15 KB 1.15 KB NODE_PROD
react-events-tap.production.min.js 🔺+3.9% 🔺+4.0% 6.25 KB 6.49 KB 2.5 KB 2.6 KB NODE_PROD

Generated by 🚫 dangerJS against 6141877

@aweary
Copy link
Contributor

aweary commented Sep 6, 2019

@necolas I'm not sure its related to these changes, but long press and press via the Enter key don't seem to work for me in that demo (Chrome 76 on macOS)

@necolas necolas force-pushed the react-events/tap-max-distance branch from 91b2413 to ed2e832 Compare September 6, 2019 20:03
@necolas
Copy link
Contributor Author

necolas commented Sep 6, 2019

LongPress will be a separate responder. And see 9ce8711 for related context

Copy link
Contributor

@trueadm trueadm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if the maximumDistance is set to 0? I assume that wouldn't work here? Should we warn against using < 0?

@necolas
Copy link
Contributor Author

necolas commented Sep 10, 2019

What happens if the maximumDistance is set to 0? I assume that wouldn't work here?

Why is that?

@trueadm
Copy link
Contributor

trueadm commented Sep 10, 2019

@necolas Unless I'm mistaken, moveDistance > maxDistance means that if you didn't move and max distance is 0, then it would fail to trigger?

@necolas
Copy link
Contributor Author

necolas commented Sep 10, 2019

Yeah I think if you moved back over the initial point, in that case it would not fire onTapUpdate

A prop for configuring the maximum distance that the active pointer can move before the tap is cancelled.
@necolas necolas force-pushed the react-events/tap-max-distance branch from ed2e832 to 6141877 Compare September 10, 2019 18:47
@necolas necolas merged commit 41a78cd into facebook:master Sep 10, 2019
@necolas necolas deleted the react-events/tap-max-distance branch December 20, 2019 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants