-
Notifications
You must be signed in to change notification settings - Fork 902
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
Add unstable_reactLegacyComponent
to cli-platform-android
#1849
Add unstable_reactLegacyComponent
to cli-platform-android
#1849
Conversation
…in the interop layer Summary: This change depends on [this PR](react-native-community/cli#1849) of the CLI that introduces the `unstable_reactLegacyComponent` field in the `react-native.config.js` file. This change introduce a JS script that reads that fields and generated a method in an object to return a list of components to be registered. The RCTAppDelegate has been updated to read those components and to automatically register them into the interop layer. Notice that a user can just update the `react-native.config.js` and rebuild the app to integrate these changes, there is no need to reinstall the pods. The idea behind this logic is to let the user know which components they are using with the interop layer, rather than rely on some black magic that could leave them blind to the need of actually migrate their apps. ## Changelog: [iOS][Changed] - Implement mechanism to register components in the iOS Fabric interop layer Differential Revision: D43665973 fbshipit-source-id: 0de4664ea6513b7664c30e8fbf6923f92df46766
…in the interop layer (facebook#36335) Summary: Pull Request resolved: facebook#36335 This change depends on [this PR](react-native-community/cli#1849) of the CLI that introduces the `unstable_reactLegacyComponent` field in the `react-native.config.js` file. This change introduce a JS script that reads that fields and generated a method in an object to return a list of components to be registered. The RCTAppDelegate has been updated to read those components and to automatically register them into the interop layer. Notice that a user can just update the `react-native.config.js` and rebuild the app to integrate these changes, there is no need to reinstall the pods. The idea behind this logic is to let the user know which components they are using with the interop layer, rather than rely on some black magic that could leave them blind to the need of actually migrate their apps. ## Changelog: [iOS][Changed] - Implement mechanism to register components in the iOS Fabric interop layer Reviewed By: dmytrorykun Differential Revision: D43665973 fbshipit-source-id: 9f5687a383c1430c2793d1af8523d811e44b8a66
… in the interop layer (facebook#36335) Summary: Pull Request resolved: facebook#36335 This change depends on [this PR](react-native-community/cli#1849) of the CLI that introduces the `unstable_reactLegacyComponent` field in the `react-native.config.js` file. This change introduce a JS script that reads that fields and generated a method in an object to return a list of components to be registered. The `RCTAppDelegate` has been updated to read those components and to automatically register them into the interop layer. Notice that a user can just update the `react-native.config.js` and rebuild the app to integrate these changes, there is no need to reinstall the pods. The idea behind this logic is to let the user know which components they are using with the interop layer, rather than rely on some black magic that could leave them blind to the need of actually migrate their apps. ## Changelog: [iOS][Changed] - Implement mechanism to register legacy components in the iOS Fabric interop layer Reviewed By: cortinico, dmytrorykun Differential Revision: D43665973 fbshipit-source-id: d42c6f58bd1bb69eb938f0473c3004a91392eacc
… in the interop layer (facebook#36335) Summary: Pull Request resolved: facebook#36335 This change depends on [this PR](react-native-community/cli#1849) of the CLI that introduces the `unstable_reactLegacyComponent` field in the `react-native.config.js` file. This change introduce a JS script that reads that fields and generated a method in an object to return a list of components to be registered. The `RCTAppDelegate` has been updated to read those components and to automatically register them into the interop layer. Notice that a user can just update the `react-native.config.js` and rebuild the app to integrate these changes, there is no need to reinstall the pods. The idea behind this logic is to let the user know which components they are using with the interop layer, rather than rely on some black magic that could leave them blind to the need of actually migrate their apps. ## Changelog: [iOS][Changed] - Implement mechanism to register legacy components in the iOS Fabric interop layer Reviewed By: cortinico, dmytrorykun Differential Revision: D43665973 fbshipit-source-id: 760a016bd717fd098273d755fab1bbdb984bd66e
… in the interop layer (facebook#36335) Summary: Pull Request resolved: facebook#36335 This change depends on [this PR](react-native-community/cli#1849) of the CLI that introduces the `unstable_reactLegacyComponent` field in the `react-native.config.js` file. This change introduce a JS script that reads that fields and generated a method in an object to return a list of components to be registered. The `RCTAppDelegate` has been updated to read those components and to automatically register them into the interop layer. Notice that a user can just update the `react-native.config.js` and rebuild the app to integrate these changes, there is no need to reinstall the pods. The idea behind this logic is to let the user know which components they are using with the interop layer, rather than rely on some black magic that could leave them blind to the need of actually migrate their apps. ## Changelog: [iOS][Changed] - Implement mechanism to register legacy components in the iOS Fabric interop layer Differential Revision: https://internalfb.com/D43665973 fbshipit-source-id: 22ef2ec769afad76624797e07c8e5bed28011449
52ac6ec
to
423d643
Compare
unstable_reactLegacyComponent
to cli-platform-android
423d643
to
a7c67df
Compare
unstable_reactLegacyComponent
to cli-platform-android
unstable_reactLegacyComponent
to cli-platform-android
Does this work with 3rd party components from node_modules as well? |
Yes it will work with 3rd party components as well, as long as the user knows the name of the components. We could make it more smart so that libraries can expose a list of components names, but we think this is going to be a more "advanced" feature at least for now, so we assume the users know which components they want to register. On top of this, unregistered component which are not fabric compatible show a Redbox that says "The component 'XYZ' is not Fabric Compatible yet". That's the name that needs to be registered here. |
Ok. Once that's in, we could improve the error message to include adjusting the react-native.config.js, at least for non-expo projects |
You mean for the "Unregistered components"? We can totally do so |
hence the `unstable_` prefix. | ||
|
||
An array with a list of Legacy Component Name that you want to be registered with the Fabric Interop Layer. | ||
This will allow you to use on the New Architecture, libreries that are legacy and haven't been migrated yet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will allow you to use on the New Architecture, libreries that are legacy and haven't been migrated yet. | |
This will allow you to use on the New Architecture, libraries that are legacy and haven't been migrated yet. |
;)
Code looks good 💪 |
… in the interop layer (#36335) Summary: Pull Request resolved: #36335 This change depends on [this PR](react-native-community/cli#1849) of the CLI that introduces the `unstable_reactLegacyComponent` field in the `react-native.config.js` file. This change introduce a JS script that reads that fields and generated a method in an object to return a list of components to be registered. The `RCTAppDelegate` has been updated to read those components and to automatically register them into the interop layer. Notice that a user can just update the `react-native.config.js` and rebuild the app to integrate these changes, there is no need to reinstall the pods. The idea behind this logic is to let the user know which components they are using with the interop layer, rather than rely on some black magic that could leave them blind to the need of actually migrate their apps. ## Changelog: [iOS][Changed] - Implement mechanism to register legacy components in the iOS Fabric interop layer Reviewed By: cortinico, dmytrorykun Differential Revision: D43665973 fbshipit-source-id: b4e8d71fa1bbed7a6130ee4f83a6221394d5306e
To test locally:
module.exports = {
project: {
android: {
unstable_reactLegacyComponent: [
'RCTImageView'
]
},
},
};
|
unstable_reactLegacyComponentNames: t | ||
.array() | ||
.items(t.string()) | ||
.default([]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: for iOS, we just need these same lines in the iOS project above (Line 149).
The CLI doesn't have to do anything else for iOS, we just need the same key structure.
I can do it in a separate PR, if you prefer.
Thanks @cortinico :) Got an error when using error Failed to load configuration of your project.
Config Validation Error: "platforms.android.unstable_reactLegacyComponentNames" is not allowed
at readConfigFromDisk [...] But when I've switched to |
… in the interop layer (facebook#36335) Summary: Pull Request resolved: facebook#36335 This change depends on [this PR](react-native-community/cli#1849) of the CLI that introduces the `unstable_reactLegacyComponent` field in the `react-native.config.js` file. This change introduce a JS script that reads that fields and generated a method in an object to return a list of components to be registered. The `RCTAppDelegate` has been updated to read those components and to automatically register them into the interop layer. Notice that a user can just update the `react-native.config.js` and rebuild the app to integrate these changes, there is no need to reinstall the pods. The idea behind this logic is to let the user know which components they are using with the interop layer, rather than rely on some black magic that could leave them blind to the need of actually migrate their apps. ## Changelog: [iOS][Changed] - Implement mechanism to register legacy components in the iOS Fabric interop layer Reviewed By: cortinico, dmytrorykun Differential Revision: D43665973 fbshipit-source-id: b4e8d71fa1bbed7a6130ee4f83a6221394d5306e
@cortinico i am getting this error, i tried both platform and project. Config Validation Error: "platform.ios.unstable_reactLegacyComponent" is not allowed platforms: { |
As suggested in this thread, you should use |
Summary:
This adds the
unstable_reactLegacyComponent
config key inside theandroid.project.
object, so that users can use thereact-native.config.js
file to register a list of component they want to use on the New Architecture that are not yet migrated to support Fabric.I've added the
unstable_
prefix as this is most likely going to change, but we'd like to have it out so soon-ish we can ask users to try it and report back if there are blockers.I've added docs for this field:
Test Plan:
I've tested this on the latest nightly and I was able to build correctly.