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

Event name normalization for Fabric interop #42586

Closed
wants to merge 1 commit into from

Commits on Jan 22, 2024

  1. Event name normalization for Fabric interop

    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
    dmytrorykun authored and facebook-github-bot committed Jan 22, 2024
    Configuration menu
    Copy the full SHA
    2d51462 View commit details
    Browse the repository at this point in the history