Skip to content

Add support to register New Renderer components from the AppDelegate.#37273

Closed
cipolleschi wants to merge 2 commits into
facebook:mainfrom
cipolleschi:export-D45605688
Closed

Add support to register New Renderer components from the AppDelegate.#37273
cipolleschi wants to merge 2 commits into
facebook:mainfrom
cipolleschi:export-D45605688

Conversation

@cipolleschi
Copy link
Copy Markdown
Contributor

Summary:
When using dynamic frameworks, we can't rely on Codegen to register all the components into the renderer. That's because, we would have to codegen a new target, which depends on ALL the 3rd party dependencies that expose a UI component.

The previous PR adds support for distributed automatic registration when components are loaded in memory.

However, not to slow down the adoption of the New Architecture, there could be apps that need to register a component that does not support the distributed approach yet. Thanks to this method, apps can register those components.

Changelog:

[iOS][Added] - Added a mechanism to register components into the renderer from the user app.

Differential Revision: D45605688

@facebook-github-bot 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 fb-exported labels May 5, 2023
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D45605688

@analysis-bot
Copy link
Copy Markdown

analysis-bot commented May 5, 2023

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 8,732,592 -1
android hermes armeabi-v7a 8,043,923 -2
android hermes x86 9,221,937 -3
android hermes x86_64 9,074,913 +1
android jsc arm64-v8a 9,297,787 +1
android jsc armeabi-v7a 8,486,552 +0
android jsc x86 9,358,534 +2
android jsc x86_64 9,615,112 -1

Base commit: d8ced6f
Branch: main

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D45605688

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D45605688

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D45605688

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D45605688

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D45605688

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D45605688

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D45605688

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D45605688

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D45605688

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D45605688

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D45605688

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D45605688

Riccardo Cipolleschi and others added 2 commits May 15, 2023 07:02
…namic Libraries (facebook#37274)

Summary:
Pull Request resolved: facebook#37274

With dynamic frameworks, we can't use floating C functions.

The way in which dynamic frameworks work is that they need to be self contained. They are built in isolation so that other frameworks can be linked against them to solve their dependencies.

Currently, when working with 3rd party libraries, we are Codegenerating a RCTThirdPartyComponentProvider which tries to invoke floating C functions that are defined in other modules. React-RCTFabric has no visibility on those modules, therefore it fails building.

The implemented solution exclude the generation of those symbols and leverage a the Objective-C runtime to automatically register libraries when they are loaded.

**This mechanism is applied ONLY when the flag RCT_DYNAMIC_FRAMEWORKS is turned on.** There will be no impact on internal meta apps, nor on any apps that are not using Dynamic Frameworks.

This change requires a small migration in all the Fabric components libraries that wants to support dynamic frameworks. They have to implement a
```
+ (void)load
{
  [super load];
}
```
method in their ComponentView.

Not to slow down the adoption of the new architecture, waiting for a migration in the ecosystem, the next diff introduce a secondary, declarative loading mechanism for Fabric Components, which follows the same approach used by TurboModules.

## Changelog:
[iOS][Changed] - Add support for distributed registration of  Fabric Components with Dynamic Libraries.

Notes that this change is NOT breaking as dynamic frameworks were not working before in the New Architecture. Static Libraries and Static Frameworks continue working as usual.

Differential Revision: https://internalfb.com/D45605441

fbshipit-source-id: a55c9cfa2b09d539fd9e38337493d2341461fdf3
…facebook#37273)

Summary:
Pull Request resolved: facebook#37273

When using dynamic frameworks, we can't rely on Codegen to register all the components into the renderer. That's because, we would have to codegen a new target, which depends on ALL the 3rd party dependencies that expose a UI component.

The previous PR adds support for distributed automatic registration when components are loaded in memory.

However, not to slow down the adoption of the New Architecture, there could be apps that need to register a component that does not support the distributed approach yet. Thanks to this method, apps can register those components.

## Changelog:
[iOS][Added] - Added a mechanism to register components into the renderer from the user app.

Reviewed By: dmytrorykun

Differential Revision: D45605688

fbshipit-source-id: 05e40ef3ac302647ea55f37c3260ca9234791c85
cipolleschi pushed a commit to cipolleschi/react-native that referenced this pull request May 15, 2023
…facebook#37273)

Summary:
Pull Request resolved: facebook#37273

When using dynamic frameworks, we can't rely on Codegen to register all the components into the renderer. That's because, we would have to codegen a new target, which depends on ALL the 3rd party dependencies that expose a UI component.

The previous PR adds support for distributed automatic registration when components are loaded in memory.

However, not to slow down the adoption of the New Architecture, there could be apps that need to register a component that does not support the distributed approach yet. Thanks to this method, apps can register those components.

## Changelog:
[iOS][Added] - Added a mechanism to register components into the renderer from the user app.

Differential Revision: https://www.internalfb.com/diff/D45605688?entry_point=27

fbshipit-source-id: b68e8582a6c220d79236ab9425d46f45c6b0f3f1
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D45605688

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label May 15, 2023
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request has been merged in ce116b6.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants