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

Experimental event API: loosen EventTarget constraints and warnings #15292

Merged
merged 2 commits into from
Apr 2, 2019

Conversation

trueadm
Copy link
Contributor

@trueadm trueadm commented Apr 1, 2019

Upon further internal discussion with @sebmarkbage in regards to the internal event API, this changes the EventTarget to not have the constraint on having to be a direct child of an EventComponet, so they can be composed as so:

<Press>
  <div>
    <TouchHitTarget />
  </div>
</Press>

Copy link
Collaborator

@sebmarkbage sebmarkbage left a comment

Choose a reason for hiding this comment

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

Relaxing the warning makes sense but for this to make sense we need to also change the semantics of it so that it picks up the parent element instead of nested child element in getElementFromTouchHitTarget.

export default function getElementFromTouchHitTarget(
I guess this just needs to traverse the .return path.

Apply fiber tree traversal

Apply fiber tree traversal (remove null check)

Apply fiber tree traversal (remove null check)
@trueadm trueadm force-pushed the change-event-target-heuristics branch from 56e385b to 57a1743 Compare April 2, 2019 13:26
@sizebot
Copy link

sizebot commented Apr 2, 2019

ReactDOM: size: -0.0%, gzip: -0.0%

Details of bundled changes.

Comparing: 4482fdd...57a1743

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.development.js 0.0% -0.2% 814.12 KB 814.15 KB 184.32 KB 184.03 KB UMD_DEV
react-dom.production.min.js -0.0% -0.0% 105.15 KB 105.11 KB 33.98 KB 33.97 KB UMD_PROD
react-dom.profiling.min.js -0.0% -0.0% 108.13 KB 108.08 KB 34.62 KB 34.61 KB UMD_PROFILING
react-dom.development.js 0.0% -0.2% 808.51 KB 808.54 KB 182.73 KB 182.43 KB NODE_DEV
react-dom.production.min.js -0.0% -0.0% 105.13 KB 105.08 KB 33.48 KB 33.47 KB NODE_PROD
react-dom.profiling.min.js -0.0% -0.0% 108.23 KB 108.18 KB 34.09 KB 34.08 KB NODE_PROFILING
ReactDOM-dev.js 0.0% -0.1% 833.25 KB 833.38 KB 184.37 KB 184.1 KB FB_WWW_DEV
ReactDOM-prod.js -0.1% -0.1% 331.56 KB 331.29 KB 61.06 KB 60.98 KB FB_WWW_PROD
ReactDOM-profiling.js -0.1% -0.1% 337.95 KB 337.74 KB 62.41 KB 62.35 KB FB_WWW_PROFILING
react-dom-unstable-fire.development.js 0.0% -0.2% 814.47 KB 814.5 KB 184.47 KB 184.18 KB UMD_DEV
react-dom-unstable-fire.production.min.js -0.0% -0.0% 105.17 KB 105.12 KB 33.99 KB 33.97 KB UMD_PROD
react-dom-unstable-fire.profiling.min.js -0.0% -0.0% 108.14 KB 108.1 KB 34.62 KB 34.62 KB UMD_PROFILING
react-dom-unstable-fire.development.js 0.0% -0.2% 808.85 KB 808.89 KB 182.86 KB 182.57 KB NODE_DEV
react-dom-unstable-fire.production.min.js -0.0% -0.0% 105.14 KB 105.1 KB 33.49 KB 33.48 KB NODE_PROD
react-dom-unstable-fire.profiling.min.js -0.0% -0.0% 108.24 KB 108.2 KB 34.09 KB 34.09 KB NODE_PROFILING
ReactFire-dev.js 0.0% -0.1% 832.46 KB 832.59 KB 184.29 KB 184.03 KB FB_WWW_DEV
ReactFire-prod.js -0.1% -0.2% 320.22 KB 319.95 KB 58.73 KB 58.62 KB FB_WWW_PROD
ReactFire-profiling.js -0.1% -0.1% 326.55 KB 326.35 KB 60.08 KB 60.02 KB FB_WWW_PROFILING
react-dom-test-utils.development.js 0.0% 0.0% 47.49 KB 47.49 KB 12.98 KB 12.98 KB UMD_DEV
react-dom-test-utils.production.min.js 0.0% 🔺+0.1% 9.95 KB 9.95 KB 3.65 KB 3.66 KB UMD_PROD
react-dom-test-utils.development.js 0.0% 0.0% 47.21 KB 47.21 KB 12.91 KB 12.91 KB NODE_DEV
react-dom-test-utils.production.min.js 0.0% 🔺+0.1% 9.73 KB 9.73 KB 3.58 KB 3.59 KB NODE_PROD
react-dom-unstable-native-dependencies.development.js 0.0% 0.0% 60.74 KB 60.74 KB 15.84 KB 15.84 KB UMD_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% 🔺+0.1% 10.69 KB 10.69 KB 3.67 KB 3.67 KB UMD_PROD
react-dom-unstable-native-dependencies.development.js 0.0% 0.0% 60.41 KB 60.41 KB 15.71 KB 15.72 KB NODE_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% 🔺+0.1% 10.42 KB 10.42 KB 3.56 KB 3.57 KB NODE_PROD
react-dom-server.browser.development.js 0.0% 0.0% 134.78 KB 134.78 KB 35.51 KB 35.51 KB UMD_DEV
react-dom-server.browser.production.min.js 0.0% 0.0% 19.05 KB 19.05 KB 7.18 KB 7.18 KB UMD_PROD
react-dom-server.browser.development.js 0.0% 0.0% 130.91 KB 130.91 KB 34.57 KB 34.57 KB NODE_DEV
react-dom-server.browser.production.min.js 0.0% 0.0% 18.98 KB 18.98 KB 7.17 KB 7.17 KB NODE_PROD
ReactDOMServer-dev.js 0.0% 0.0% 133.22 KB 133.22 KB 34.32 KB 34.32 KB FB_WWW_DEV
ReactDOMServer-prod.js 0.0% 0.0% 46.19 KB 46.19 KB 10.63 KB 10.63 KB FB_WWW_PROD
react-dom-server.node.development.js 0.0% 0.0% 132.86 KB 132.86 KB 35.12 KB 35.12 KB NODE_DEV
react-dom-server.node.production.min.js 0.0% 0.0% 19.84 KB 19.84 KB 7.48 KB 7.48 KB NODE_PROD
react-dom-unstable-fizz.browser.development.js 0.0% +0.1% 3.66 KB 3.66 KB 1.45 KB 1.46 KB UMD_DEV
react-dom-unstable-fizz.browser.production.min.js 0.0% 🔺+0.4% 1.21 KB 1.21 KB 705 B 708 B UMD_PROD
react-dom-unstable-fizz.browser.development.js 0.0% +0.1% 3.49 KB 3.49 KB 1.41 KB 1.41 KB NODE_DEV
react-dom-unstable-fizz.browser.production.min.js 0.0% 🔺+0.5% 1.05 KB 1.05 KB 636 B 639 B NODE_PROD
react-dom-unstable-fizz.node.development.js 0.0% +0.1% 3.74 KB 3.74 KB 1.43 KB 1.43 KB NODE_DEV
react-dom-unstable-fizz.node.production.min.js 0.0% 🔺+0.5% 1.1 KB 1.1 KB 666 B 669 B NODE_PROD

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-art.development.js +0.2% +0.1% 567.33 KB 568.43 KB 122.49 KB 122.58 KB UMD_DEV
react-art.production.min.js 0.0% 0.0% 96.8 KB 96.8 KB 29.69 KB 29.69 KB UMD_PROD
react-art.development.js +0.2% +0.1% 498.24 KB 499.34 KB 105.09 KB 105.21 KB NODE_DEV
react-art.production.min.js 0.0% 0.0% 61.81 KB 61.81 KB 18.91 KB 18.92 KB NODE_PROD
ReactART-dev.js +0.2% +0.1% 508.16 KB 509.24 KB 104.39 KB 104.48 KB FB_WWW_DEV
ReactART-prod.js 🔺+0.3% 🔺+0.2% 196.81 KB 197.31 KB 33.32 KB 33.38 KB FB_WWW_PROD

react-native-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactNativeRenderer-dev.js +0.2% +0.1% 629.31 KB 630.49 KB 134.21 KB 134.33 KB RN_FB_DEV
ReactNativeRenderer-prod.js 0.0% 0.0% 246.06 KB 246.06 KB 43.03 KB 43.03 KB RN_FB_PROD
ReactNativeRenderer-profiling.js 0.0% 0.0% 252.31 KB 252.31 KB 44.38 KB 44.38 KB RN_FB_PROFILING
ReactNativeRenderer-dev.js +0.2% +0.1% 629.23 KB 630.4 KB 134.18 KB 134.3 KB RN_OSS_DEV
ReactNativeRenderer-prod.js 0.0% 0.0% 246.07 KB 246.07 KB 43.03 KB 43.03 KB RN_OSS_PROD
ReactNativeRenderer-profiling.js 0.0% 0.0% 252.33 KB 252.33 KB 44.38 KB 44.38 KB RN_OSS_PROFILING
ReactFabric-dev.js +0.2% +0.1% 618.17 KB 619.34 KB 131.57 KB 131.68 KB RN_FB_DEV
ReactFabric-prod.js 0.0% 0.0% 239.46 KB 239.46 KB 41.77 KB 41.77 KB RN_FB_PROD
ReactFabric-profiling.js 0.0% 0.0% 244.8 KB 244.8 KB 43.09 KB 43.09 KB RN_FB_PROFILING
ReactFabric-dev.js +0.2% +0.1% 618.07 KB 619.25 KB 131.52 KB 131.63 KB RN_OSS_DEV
ReactFabric-prod.js 0.0% 0.0% 239.47 KB 239.47 KB 41.76 KB 41.76 KB RN_OSS_PROD
ReactFabric-profiling.js 0.0% 0.0% 244.81 KB 244.81 KB 43.08 KB 43.08 KB RN_OSS_PROFILING

react-test-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-test-renderer.development.js +0.1% -0.1% 509.78 KB 510.07 KB 107.26 KB 107.16 KB UMD_DEV
react-test-renderer.production.min.js -0.1% -0.1% 62.79 KB 62.75 KB 19.14 KB 19.12 KB UMD_PROD
react-test-renderer.development.js +0.1% -0.1% 505.3 KB 505.59 KB 106.11 KB 106.01 KB NODE_DEV
react-test-renderer.production.min.js -0.1% -0.0% 62.48 KB 62.44 KB 18.97 KB 18.96 KB NODE_PROD
ReactTestRenderer-dev.js +0.1% -0.1% 516.46 KB 516.73 KB 105.87 KB 105.77 KB FB_WWW_DEV
react-test-renderer-shallow.development.js 0.0% 0.0% 38.98 KB 38.98 KB 9.81 KB 9.81 KB UMD_DEV
react-test-renderer-shallow.production.min.js 0.0% 0.0% 11.42 KB 11.42 KB 3.5 KB 3.51 KB UMD_PROD
react-test-renderer-shallow.development.js 0.0% 0.0% 33.2 KB 33.2 KB 8.41 KB 8.42 KB NODE_DEV
react-test-renderer-shallow.production.min.js 0.0% 0.0% 11.61 KB 11.61 KB 3.63 KB 3.63 KB NODE_PROD

react-noop-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-noop-renderer.development.js -2.9% -4.0% 32.15 KB 31.23 KB 7.96 KB 7.64 KB NODE_DEV
react-noop-renderer.production.min.js -1.2% -2.4% 10.13 KB 10 KB 3.3 KB 3.22 KB NODE_PROD
react-noop-renderer-persistent.development.js -2.9% -3.9% 32.27 KB 31.34 KB 7.97 KB 7.66 KB NODE_DEV
react-noop-renderer-persistent.production.min.js -1.2% -2.4% 10.15 KB 10.03 KB 3.31 KB 3.23 KB NODE_PROD
react-noop-renderer-server.development.js 0.0% +0.3% 1.83 KB 1.83 KB 875 B 878 B NODE_DEV
react-noop-renderer-server.production.min.js 0.0% 🔺+0.6% 813 B 813 B 489 B 492 B NODE_PROD

react-reconciler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-reconciler.development.js +0.2% +0.1% 498.34 KB 499.54 KB 103.94 KB 104.03 KB NODE_DEV
react-reconciler.production.min.js 0.0% 0.0% 62.99 KB 62.99 KB 18.74 KB 18.74 KB NODE_PROD
react-reconciler-persistent.development.js +0.2% +0.1% 496.23 KB 497.43 KB 103.07 KB 103.17 KB NODE_DEV
react-reconciler-persistent.production.min.js 0.0% 0.0% 63 KB 63 KB 18.75 KB 18.75 KB NODE_PROD
react-reconciler-reflection.development.js 0.0% 0.0% 15.79 KB 15.79 KB 4.91 KB 4.91 KB NODE_DEV
react-reconciler-reflection.production.min.js 0.0% 🔺+0.2% 2.37 KB 2.37 KB 1.07 KB 1.07 KB NODE_PROD

Generated by 🚫 dangerJS

Copy link
Contributor

@threepointone threepointone left a comment

Choose a reason for hiding this comment

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

it seems right to me, thanks for the tests. I assume there's a plan to flesh the TODOs out in upcoming PRs.

@trueadm trueadm merged commit 6a1e6b2 into facebook:master Apr 2, 2019
@trueadm trueadm deleted the change-event-target-heuristics branch April 2, 2019 18:49
NMinhNguyen referenced this pull request in enzymejs/react-shallow-renderer Jan 29, 2020
…#15292)

* Remove warning for event targets being direct children of event component

* Addressed feedback and added more test coverage + warnings
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.

5 participants