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

Make the Fabric Interop layer work in Bridgeless #40732

Closed
wants to merge 1 commit into from

Commits on Oct 10, 2023

  1. Make the Fabric Interop layer work in Bridgeless (facebook#40732)

    Summary:
    
    This change allows the Fabric Interop Layer to work in bridgeless mode.
    
    Given that the legacy components requires a Bridge to send events and use commands, this change simulates a bridge when it doesn't exists (i.e.: we are in bridgeless mode).
    
    In order to make it work, we had to simulate a few elements from the Bridge and the UIManager.
    
    ## Changelog:
    [iOS][Fixed] - Make the Fabric interop layer works in bridgeless mode.
    
    ## Facebook:
    As an alternative approach, we could have created a `protocol RCTBridging`, have the `RCTBridge` conform to that protocol, and create a new type for it.
    Practically this would have been much more cumbersome:
    1. The [RCTBridge](https://www.internalfb.com/code/fbsource/[916531b9bf7a9943036807f7563c925b4c3e0101]/xplat/js/react-native-github/packages/react-native/React/Base/RCTBridge.h?lines=87-238) interface is quite big. All the props and method should be part of the protocol.
    2. Extensions declared on RCTBridge would not have worked. For example, [`RCTBridge (RCTUIManager)`](https://www.internalfb.com/code/fbsource/[916531b9bf7a9943036807f7563c925b4c3e0101]/xplat/js/react-native-github/packages/react-native/React/Modules/RCTUIManager.h?lines=170-174).
    3. It would require a major overhaul of the APIs, returning `id<RCTBridging>` in place of **every** function that takes/return an instance of `RCTBridge *`.
    
    Clearly, not a feasible way to go.
    
    Reviewed By: RSNara
    
    Differential Revision: D50079929
    Riccardo Cipolleschi authored and facebook-github-bot committed Oct 10, 2023
    Configuration menu
    Copy the full SHA
    76b84ac View commit details
    Browse the repository at this point in the history