-
Notifications
You must be signed in to change notification settings - Fork 50.2k
[React Native] Remove eventTypes from ReactNativeBridgeEventPlugin #15802
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
Conversation
|
|
||
| const ReactNativeBridgeEventPlugin = { | ||
| eventTypes: eventTypes, | ||
| eventTypes: {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: even though the docstring says this is optional, the flowtype disagress
|
Note that the |
|
No significant bundle size changes to report. Generated by 🚫 dangerJS |
gaearon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not super familiar with this but if they're already lazy loaded then this looks fine to me
cpojer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
This comment has been minimized.
This comment has been minimized.
Summary: This diff syncs a commit from React to bring in facebook/react#15802 (review) Reviewed By: cpojer Differential Revision: D15660020 fbshipit-source-id: 15d2413a69968b2898bb37d256f35bc09ebc8d58
Summary: This isn't a full sync. It only includes cherry-picked commits for Fresh, as well as previously cherry-picked commits during last two syncs. Changes that are already synced: * facebook/react#15604 * facebook/react#15786 * facebook/react#15802 New changes: * gaearon/react@5be064b * gaearon/react@6b6d8fa * gaearon/react@92bcf2a * gaearon/react@7b4c2f7 * gaearon/react@39a3f2f * gaearon/react@cabdebb * gaearon/react@a277671 * gaearon/react@86aad18 * gaearon/react@25b3e07 * gaearon/react@ffee295 * gaearon/react@a817bc5 * gaearon/react@abb2f0f * gaearon/react@2e20d9e * gaearon/react@5d35024 * gaearon/react@6628573 * gaearon/react@5815bff **This might look like a lot but note that very few of these actually touch the renderer code.** Most affect integration tests and `react-refresh` package which **has already been synced separately**. So this is about getting in a few renderer changes that were included in those commits. That's very self-contained. The renderer source diff is this: https://gist.github.com/gaearon/ddbda5845b4dba0d9915e2ed7f7b11e2. You can also see that in prod bundles below there's only one meaningful change (`type` used instead of `elementType`) which in that case is equivalent. Reviewed By: rickhanlonii Differential Revision: D15898205 fbshipit-source-id: 19619f4ff01f24765613f19e826b0199485d81bb
Summary: This diff syncs a commit from React to bring in facebook/react#15802 (review) Reviewed By: cpojer Differential Revision: D15660020 fbshipit-source-id: 15d2413a69968b2898bb37d256f35bc09ebc8d58 (cherry picked from commit c1e03b3)
Summary: This diff syncs a commit from React to bring in facebook/react#15802 (review) Reviewed By: cpojer Differential Revision: D15660020 fbshipit-source-id: 15d2413a69968b2898bb37d256f35bc09ebc8d58
Summary: This isn't a full sync. It only includes cherry-picked commits for Fresh, as well as previously cherry-picked commits during last two syncs. Changes that are already synced: * facebook/react#15604 * facebook/react#15786 * facebook/react#15802 New changes: * gaearon/react@5be064b * gaearon/react@6b6d8fa * gaearon/react@92bcf2a * gaearon/react@7b4c2f7 * gaearon/react@39a3f2f * gaearon/react@cabdebb * gaearon/react@a277671 * gaearon/react@86aad18 * gaearon/react@25b3e07 * gaearon/react@ffee295 * gaearon/react@a817bc5 * gaearon/react@abb2f0f * gaearon/react@2e20d9e * gaearon/react@5d35024 * gaearon/react@6628573 * gaearon/react@5815bff **This might look like a lot but note that very few of these actually touch the renderer code.** Most affect integration tests and `react-refresh` package which **has already been synced separately**. So this is about getting in a few renderer changes that were included in those commits. That's very self-contained. The renderer source diff is this: https://gist.github.com/gaearon/ddbda5845b4dba0d9915e2ed7f7b11e2. You can also see that in prod bundles below there's only one meaningful change (`type` used instead of `elementType`) which in that case is equivalent. Reviewed By: rickhanlonii Differential Revision: D15898205 fbshipit-source-id: 19619f4ff01f24765613f19e826b0199485d81bb
Overview
This PR fixes an issue with switching between paper and fabric in React Native.
Explanation
On first initialization of React Native,
ReactNativeBridgeEventPlugin.eventTypesis empty because view configs are lazily loaded. This means that theEventPluginRegistrydoes not run checks on events, and does not error when registering here.If there is a second initialization (e.g. loading the fabric bundle after the paper bundle), then the
eventTypesmay be populated with host component events from view configs loaded at runtime.This means that the
EventPluginRegistrycan error when registering the plugin if there are colliding registration names, even though these events were already in use.This change allows the EventPluginRegistry to perform the same on initial load between all of the bundles by forcing the eventTypes to an empty object.
Justification
From the EventPluginHub doc comments, eventTypes are optional:
For ReactNative, we register our own top level listeners in our native host components so there is no need to register them in the EventPluginHub.
Testing
See https://fburl.com/diff/5l6zql59 for test plan.