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] Various core tweaks for event responder system #16654

Merged
merged 2 commits into from
Sep 4, 2019

Conversation

trueadm
Copy link
Contributor

@trueadm trueadm commented Sep 4, 2019

This PR introduces a few fixes and core changes that are required for having event listeners/responders on scope components:

  • Removes responderTarget from the responder event object. Instead context.getCurrentTarget() has been introduced that achieves the same purpose, without needing to mutate the event object. Furthermore, this works with scopes, which do not have a direct DOM node (instead the nearest current DOM from the target is picked up).

  • Fixes a bug @necolas found and fixed in another PR, which also came up in this with the responder target changes above, so they were needed here too.

  • Scope components via React.unstable_createScope now accept event responders via the listeners prop, like host components can. This makes it easier to compose scopes that need to tight control over handling things like keyboard/focus interactions.

@sizebot
Copy link

sizebot commented Sep 4, 2019

Details of bundled changes.

Comparing: af03276...28b73a6

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-art.development.js +0.2% +0.1% 655.77 KB 656.91 KB 142.94 KB 143.08 KB UMD_DEV
react-art.production.min.js 0.0% 0.0% 101.93 KB 101.93 KB 31.17 KB 31.17 KB UMD_PROD
react-art.development.js +0.2% +0.1% 586.44 KB 587.59 KB 125.49 KB 125.63 KB NODE_DEV
ReactART-dev.js +0.2% +0.1% 601.49 KB 602.48 KB 125.19 KB 125.33 KB FB_WWW_DEV
ReactART-prod.js 🔺+0.2% 🔺+0.2% 225.62 KB 225.97 KB 38.36 KB 38.42 KB FB_WWW_PROD

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.profiling.min.js 0.0% -0.0% 115.32 KB 115.32 KB 36.36 KB 36.36 KB NODE_PROFILING
react-dom-server.browser.development.js 0.0% 0.0% 142.1 KB 142.1 KB 37.12 KB 37.12 KB UMD_DEV
ReactDOM-dev.js +0.2% +0.1% 936.58 KB 938.39 KB 207.09 KB 207.32 KB FB_WWW_DEV
react-dom-test-utils.development.js 0.0% 0.0% 57.25 KB 57.25 KB 15.78 KB 15.78 KB UMD_DEV
react-dom-unstable-fizz.browser.development.js 0.0% +0.1% 3.78 KB 3.78 KB 1.53 KB 1.53 KB UMD_DEV
react-dom-test-utils.production.min.js 0.0% -0.1% 10.95 KB 10.95 KB 4.09 KB 4.09 KB NODE_PROD
react-dom.development.js +0.2% +0.1% 912.66 KB 914.59 KB 207.06 KB 207.33 KB UMD_DEV
react-dom.production.min.js 0.0% -0.0% 111.71 KB 111.71 KB 36.03 KB 36.02 KB UMD_PROD
react-dom.profiling.min.js 0.0% 0.0% 115.12 KB 115.12 KB 37.07 KB 37.08 KB UMD_PROFILING
react-dom.development.js +0.2% +0.2% 906.75 KB 908.68 KB 205.34 KB 205.66 KB NODE_DEV
react-dom.production.min.js -0.0% -0.1% 111.68 KB 111.68 KB 35.43 KB 35.39 KB NODE_PROD
ReactDOM-prod.js 🔺+0.1% 🔺+0.3% 371.46 KB 371.9 KB 67.98 KB 68.17 KB FB_WWW_PROD
ReactDOM-profiling.js +0.3% +0.2% 376.06 KB 377.02 KB 69.01 KB 69.18 KB FB_WWW_PROFILING
react-dom-server.browser.development.js 0.0% 0.0% 138.04 KB 138.04 KB 36.11 KB 36.11 KB NODE_DEV
react-dom-unstable-native-dependencies.development.js 0.0% 0.0% 60.71 KB 60.71 KB 15.84 KB 15.85 KB UMD_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% 0.0% 10.75 KB 10.75 KB 3.68 KB 3.68 KB UMD_PROD
ReactDOMServer-dev.js 0.0% 0.0% 142.39 KB 142.39 KB 35.68 KB 35.68 KB FB_WWW_DEV
react-dom-unstable-native-dependencies.development.js 0.0% 0.0% 60.39 KB 60.39 KB 15.72 KB 15.72 KB NODE_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% 0.0% 10.49 KB 10.49 KB 3.58 KB 3.58 KB NODE_PROD
react-dom-unstable-fizz.node.production.min.js 0.0% -0.1% 1.1 KB 1.1 KB 668 B 667 B NODE_PROD

react-test-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactTestRenderer-dev.js +0.2% +0.1% 612.59 KB 613.59 KB 127.62 KB 127.74 KB FB_WWW_DEV
react-test-renderer-shallow.development.js 0.0% 0.0% 39.21 KB 39.21 KB 9.95 KB 9.95 KB UMD_DEV
react-test-renderer.development.js +0.2% +0.1% 599.8 KB 600.95 KB 128.26 KB 128.4 KB UMD_DEV
react-test-renderer.development.js +0.2% +0.1% 595.13 KB 596.28 KB 127.06 KB 127.2 KB NODE_DEV

react-reconciler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-reconciler.development.js +0.2% +0.1% 585.08 KB 586.23 KB 124.19 KB 124.33 KB NODE_DEV
react-reconciler.production.min.js 0.0% -0.0% 68.94 KB 68.94 KB 20.44 KB 20.44 KB NODE_PROD
react-reconciler-reflection.production.min.js 0.0% -0.1% 2.56 KB 2.56 KB 1.14 KB 1.14 KB NODE_PROD
react-reconciler-persistent.development.js +0.2% +0.1% 582.09 KB 583.24 KB 122.92 KB 123.06 KB NODE_DEV
react-reconciler-persistent.production.min.js 0.0% -0.0% 68.95 KB 68.95 KB 20.45 KB 20.45 KB NODE_PROD

react-native-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactNativeRenderer-prod.js -0.0% -0.0% 269.99 KB 269.9 KB 46.28 KB 46.26 KB RN_OSS_PROD
ReactFabric-dev.js +0.2% +0.1% 740.7 KB 742.3 KB 156.7 KB 156.92 KB RN_FB_DEV
ReactNativeRenderer-dev.js +0.1% +0.1% 734.15 KB 735.15 KB 155.53 KB 155.65 KB RN_OSS_DEV
ReactNativeRenderer-dev.js +0.1% +0.1% 734.31 KB 735.31 KB 155.61 KB 155.73 KB RN_FB_DEV
ReactNativeRenderer-prod.js -0.0% -0.0% 269.99 KB 269.9 KB 46.29 KB 46.27 KB RN_FB_PROD
ReactFabric-dev.js +0.2% +0.1% 740.53 KB 742.13 KB 156.62 KB 156.84 KB RN_OSS_DEV

Generated by 🚫 dangerJS against 28b73a6

while (node !== null) {
if (node === parentFiber || node === parentAlternateFiber) {
return true;
if (childFiber != null && parentFiber != null) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was the fix taken from the other PR.

@trueadm trueadm merged commit 539640d into facebook:master Sep 4, 2019
@trueadm trueadm deleted the scope-listeners branch September 4, 2019 17:05
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.

4 participants