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

[Native] Delete NativeComponent and NativeMethodsMixin #18036

Merged
merged 2 commits into from
Feb 13, 2020

Conversation

elicwhite
Copy link
Member

Summary

NativeComponent and NativeMethodsMixins were JS APIs for creating components that proxied the methods to the underlying host component by using findNodeHandle. Nothing in core uses these anymore, core uses forwardRef instead. We can finally delete these!

These APIs weren't exposed as part of the public API of React Native so this isn't a breaking change.

Test Plan

Jest, Flow. I also imported this diff into Facebook to run a build size bot and mobile lab. Diff here: https://our.internmc.facebook.com/intern/diff/D19458361/

@sizebot
Copy link

sizebot commented Feb 13, 2020

Details of bundled changes.

Comparing: d4f2b03...69a7f78

react-native-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactFabric-dev.js -2.9% -2.3% 744.02 KB 722.31 KB 156.21 KB 152.54 KB RN_FB_DEV
ReactFabric-prod.js -2.7% -1.8% 267.43 KB 260.24 KB 45.82 KB 44.98 KB RN_FB_PROD
ReactNativeRenderer-dev.js -2.9% -2.3% 753.22 KB 731.61 KB 158.33 KB 154.68 KB RN_OSS_DEV
ReactFabric-profiling.js -2.6% -1.8% 278.6 KB 271.41 KB 47.95 KB 47.1 KB RN_FB_PROFILING
ReactNativeRenderer-prod.js -2.6% -1.8% 274.77 KB 267.58 KB 47.03 KB 46.19 KB RN_OSS_PROD
ReactNativeRenderer-profiling.js -2.5% -1.7% 285.99 KB 278.8 KB 49.22 KB 48.37 KB RN_OSS_PROFILING
ReactNativeRenderer-dev.js -2.9% -2.3% 753.39 KB 731.79 KB 158.42 KB 154.77 KB RN_FB_DEV
ReactNativeRenderer-prod.js -2.6% -1.8% 275.16 KB 267.97 KB 47.1 KB 46.26 KB RN_FB_PROD
ReactNativeRenderer-profiling.js -2.5% -1.7% 286.38 KB 279.19 KB 49.29 KB 48.44 KB RN_FB_PROFILING
ReactFabric-dev.js -2.9% -2.4% 743.83 KB 722.12 KB 156.12 KB 152.44 KB RN_OSS_DEV
ReactFabric-prod.js -2.7% -1.8% 267.08 KB 259.89 KB 45.75 KB 44.91 KB RN_OSS_PROD
ReactFabric-profiling.js -2.6% -1.8% 278.26 KB 271.06 KB 47.88 KB 47.04 KB RN_OSS_PROFILING

Size changes (experimental)

Generated by 🚫 dangerJS against 69a7f78

@sizebot
Copy link

sizebot commented Feb 13, 2020

Details of bundled changes.

Comparing: d4f2b03...69a7f78

react-native-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactNativeRenderer-prod.js -2.6% -1.8% 274.76 KB 267.57 KB 47.03 KB 46.18 KB RN_OSS_PROD
ReactNativeRenderer-profiling.js -2.5% -1.7% 285.98 KB 278.79 KB 49.21 KB 48.36 KB RN_OSS_PROFILING
ReactFabric-dev.js -2.9% -2.4% 743.82 KB 722.11 KB 156.11 KB 152.44 KB RN_OSS_DEV
ReactFabric-prod.js -2.7% -1.8% 267.07 KB 259.88 KB 45.74 KB 44.9 KB RN_OSS_PROD
ReactFabric-profiling.js -2.6% -1.8% 278.25 KB 271.05 KB 47.88 KB 47.03 KB RN_OSS_PROFILING
ReactNativeRenderer-dev.js -2.9% -2.3% 753.2 KB 731.6 KB 158.32 KB 154.68 KB RN_OSS_DEV

Size changes (stable)

Generated by 🚫 dangerJS against 69a7f78

@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 69a7f78:

Sandbox Source
happy-sanderson-l51hv Configuration

Copy link

@zackargyle zackargyle left a comment

Choose a reason for hiding this comment

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

Yaaaaaaas 🔥🔥🔥

@elicwhite elicwhite merged commit 2d6be75 into facebook:master Feb 13, 2020
elicwhite added a commit to elicwhite/react that referenced this pull request Feb 26, 2020
* [Native] Delete NativeComponent and NativeMethodsMixin

* Remove more files

/**
* Flat ReactNative renderer bundles are too big for Flow to parse efficiently.
* Provide minimal Flow typing for the high-level RN API and call it a day.
*/
export type ReactNativeType = {
NativeComponent: typeof ReactNativeComponent,
Copy link
Contributor

@yungsters yungsters Oct 14, 2021

Choose a reason for hiding this comment

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

I think this was a breaking change because now people cannot importNativeComponent.

The fix is to migrate to the exported HostComponent type.

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