-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Event name normalization for Fabric interop #42586
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Summary: Every event name must be normalized. The normalization strategy is: 1. If it starts with `top` -> do nothing. 2. If it starts with `on` -> replace `on` with `top`. 3. Else -> capitalize the first character and prepend `top`. We have it for the old renderer on iOS [here](https://github.com/facebook/react-native/blob/a7586947d719a9cd2344ad346d271e7ca900de87/packages/react-native/React/Base/RCTEventDispatcher.m#L12-L21). This one is also used by the interop layer. Static ViewConfigs being a part of the new renderer [replicate](https://github.com/facebook/react-native/blob/a7586947d719a9cd2344ad346d271e7ca900de87/packages/react-native-codegen/src/generators/components/GenerateViewConfigJs.js#L164-L172) this behavior to match the old rendered. We've never had proper implementation for this on Android. So some events names that worked with the old renderer would not be compatible with the new renderer + Static ViewConfigs. Specifically every event name now must start with `top`. This diff implements event name normalization on Android. Changelog: [Internal] - Update event normalization algorithm to match SVCs. Differential Revision: D50604571
facebook-github-bot
added
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
p: Facebook
Partner: Facebook
Partner
labels
Jan 22, 2024
This pull request was exported from Phabricator. Differential Revision: D50604571 |
Base commit: 5e8ce6c |
This pull request has been merged in b32c6c2. |
lunaleaps
pushed a commit
that referenced
this pull request
Feb 4, 2024
Summary: Pull Request resolved: #42586 Every event name must be normalized. The normalization strategy is: 1. If it starts with `top` -> do nothing. 2. If it starts with `on` -> replace `on` with `top`. 3. Else -> capitalize the first character and prepend `top`. We have it for the old renderer on iOS [here](https://github.com/facebook/react-native/blob/a7586947d719a9cd2344ad346d271e7ca900de87/packages/react-native/React/Base/RCTEventDispatcher.m#L12-L21). This one is also used by the interop layer. Static ViewConfigs being a part of the new renderer [replicate](https://github.com/facebook/react-native/blob/a7586947d719a9cd2344ad346d271e7ca900de87/packages/react-native-codegen/src/generators/components/GenerateViewConfigJs.js#L164-L172) this behavior to match the old rendered. The Android that we have is incomplete, it is missing the [*2. If it starts with `on` -> replace `on` with `top`*]. This means that some events names that worked with the old renderer would not be compatible with the new renderer + Static ViewConfigs. Specifically every event names that start with `on`. This diff implements event name normalization on Android. Changelog: [Internal] - Update event normalization algorithm to match SVCs. Reviewed By: cortinico Differential Revision: D50604571 fbshipit-source-id: cef34d8baa2cf31f641be423a16bca7ea9fa20c4
This was referenced Feb 29, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
fb-exported
Merged
This PR has been merged.
p: Facebook
Partner: Facebook
Partner
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
Every event name must be normalized.
The normalization strategy is:
top
-> do nothing.on
-> replaceon
withtop
.top
.We have it for the old renderer on iOS here. This one is also used by the interop layer.
Static ViewConfigs being a part of the new renderer replicate this behavior to match the old rendered.
The Android that we have is incomplete, it is missing the [2. If it starts with
on
-> replaceon
withtop
]. This means that some events names that worked with the old renderer would not be compatible with the new renderer + Static ViewConfigs. Specifically every event names that start withon
.This diff implements event name normalization on Android.
Changelog: [Internal] - Update event normalization algorithm to match SVCs.
Differential Revision: D50604571