-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Let lib maintainer be explicit with component2Class mapping #47520
Conversation
This pull request was exported from Phabricator. Differential Revision: D65666061 |
…#47520) Summary: Right now, when a 3p library needs to register a component in the component system, we have to crawl the library to try and get the mappng, best effort. With this approach, we are enriching the `codegenConfig` property to allow library developers to define the mapping themselves. For example: ```json //... "codegenConfig": { //.. "ios": { "component2ClassMapping": { "RNTMyNativeView": "RNTMyNativeViewComponentView" } } }, ``` means that the JS component `RNTMyNativeView` will be mapped to the `RNTMyNativeViewComponentView` class. This also work for local apps, and it warns the users about what libraries are using the deprecated approach, so they can open an issue or a PR to those libraries. ## Changelog: [iOS][Added] - Allow 3p developers to specify the association between components and classes in Fabric Reviewed By: dmytrorykun Differential Revision: D65666061
5008784
to
1860c5a
Compare
This pull request was exported from Phabricator. Differential Revision: D65666061 |
1860c5a
to
3987a5f
Compare
…#47520) Summary: Pull Request resolved: facebook#47520 Right now, when a 3p library needs to register a component in the component system, we have to crawl the library to try and get the mappng, best effort. With this approach, we are enriching the `codegenConfig` property to allow library developers to define the mapping themselves. For example: ```json //... "codegenConfig": { //.. "ios": { "component2ClassMapping": { "RNTMyNativeView": "RNTMyNativeViewComponentView" } } }, ``` means that the JS component `RNTMyNativeView` will be mapped to the `RNTMyNativeViewComponentView` class. This also work for local apps, and it warns the users about what libraries are using the deprecated approach, so they can open an issue or a PR to those libraries. ## Changelog: [iOS][Added] - Allow 3p developers to specify the association between components and classes in Fabric Reviewed By: dmytrorykun Differential Revision: D65666061
This pull request was exported from Phabricator. Differential Revision: D65666061 |
…ok#47520) Summary: Right now, when a 3p library needs to register a component in the component system, we have to crawl the library to try and get the mappng, best effort. With this approach, we are enriching the `codegenConfig` property to allow library developers to define the mapping themselves. For example: ```json //... "codegenConfig": { //.. "ios": { "componentProvider": { "RNTMyNativeView": "RNTMyNativeViewComponentView" } } }, ``` means that the JS component `RNTMyNativeView` will be mapped to the `RNTMyNativeViewComponentView` class. This also work for local apps, and it warns the users about what libraries are using the deprecated approach, so they can open an issue or a PR to those libraries. ## Changelog: [iOS][Added] - Allow 3p developers to specify the association between components and classes in Fabric Reviewed By: dmytrorykun Differential Revision: D65666061
3987a5f
to
bcf4870
Compare
This pull request was exported from Phabricator. Differential Revision: D65666061 |
…ok#47520) Summary: Right now, when a 3p library needs to register a component in the component system, we have to crawl the library to try and get the mappng, best effort. With this approach, we are enriching the `codegenConfig` property to allow library developers to define the mapping themselves. For example: ```json //... "codegenConfig": { //.. "ios": { "componentProvider": { "RNTMyNativeView": "RNTMyNativeViewComponentView" } } }, ``` means that the JS component `RNTMyNativeView` will be mapped to the `RNTMyNativeViewComponentView` class. This also work for local apps, and it warns the users about what libraries are using the deprecated approach, so they can open an issue or a PR to those libraries. ## Changelog: [iOS][Added] - Allow 3p developers to specify the association between components and classes in Fabric Reviewed By: dmytrorykun Differential Revision: D65666061
bcf4870
to
0fa3382
Compare
This pull request was exported from Phabricator. Differential Revision: D65666061 |
Summary: The `RCTThirdPartyLibraryComponentProvider` has been introduced to automate the component registration of third party libraries in the apps. However, it has some serious flaws: * It is generated in the React/Fabric folder, which means that it is generated in node_modules * It is generated when the user installs the components in the app, which means that we can't prebuild and redistribute React Native as a binary * it does not work with Frameworks and dynamic linking: in this scenarion, Fabric must build in isolation and if there are third party libraries involved, the lookup of the `xxxCls` function will fail This change removes the generation of the `RCTThirdPartyLibraryComponentProvider`. In the next diffs we will implement a different mechanism to register components ## Changelog [iOS][Changed] - Stop generating the RCTThirdPartyLibraryComponentProvider Reviewed By: dmytrorykun Differential Revision: D65601939
Summary: This change reintroduce the generation of the `RCTThirdPartyComponentProvider` but in the right place and with the right patterns. 1. We are generating it in the user space, not in the node_modules (fixes the circular dependency) 2. We are not using weak function signature that have to be implicitly linked to some symbols found during compilation The change needs to crawl the folder to retrieve the information it needs. We need to implement it this way not to be breaking with respect of the current implementation. The assumption is that components have a function in their `.mm` file with this shape: ```objc Class<RCTComponentViewProtocol> <componentName>Cls(void) { return <ComponentViewClass>.class; } ``` I verified on GH that all the libraries out there follow this pattern. A better approach will let library owner to specify the association of `componentName, componentClass` in the `codegenConfig`. We will implement that as the next step and we will support both for some versions for backward compatibility. ## Changelog [iOS][Changed] - Change how components automatically register Reviewed By: dmytrorykun Differential Revision: D65614347
…ok#47520) Summary: Right now, when a 3p library needs to register a component in the component system, we have to crawl the library to try and get the mappng, best effort. With this approach, we are enriching the `codegenConfig` property to allow library developers to define the mapping themselves. For example: ```json //... "codegenConfig": { //.. "ios": { "componentProvider": { "RNTMyNativeView": "RNTMyNativeViewComponentView" } } }, ``` means that the JS component `RNTMyNativeView` will be mapped to the `RNTMyNativeViewComponentView` class. This also work for local apps, and it warns the users about what libraries are using the deprecated approach, so they can open an issue or a PR to those libraries. ## Changelog: [iOS][Added] - Allow 3p developers to specify the association between components and classes in Fabric Reviewed By: dmytrorykun Differential Revision: D65666061
0fa3382
to
b381c67
Compare
This pull request was exported from Phabricator. Differential Revision: D65666061 |
This pull request has been merged in fe1057a. |
Summary:
Right now, when a 3p library needs to register a component in the component system, we have to crawl the library to try and get the mappng, best effort.
With this approach, we are enriching the
codegenConfig
property to allow library developers to define the mapping themselves.For example:
means that the JS component
RNTMyNativeView
will be mapped to theRNTMyNativeViewComponentView
class.This also work for local apps, and it warns the users about what libraries are using the deprecated approach, so they can open an issue or a PR to those libraries.
Changelog:
[iOS][Added] - Allow 3p developers to specify the association between components and classes in Fabric
Differential Revision: D65666061