From c2f3d7aea252eb37501a658c1a454c84672f3b33 Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Tue, 7 Mar 2023 09:50:35 +0000 Subject: [PATCH] feat: add the 'unstable_reactLegacyComponentNames' field to iOS project config --- docs/projects.md | 15 ++++++++++++++- packages/cli-config/src/schema.ts | 4 ++++ .../src/config/__tests__/getProjectConfig.test.ts | 1 - 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/docs/projects.md b/docs/projects.md index 29b4b6d5f5..d9d21196a3 100644 --- a/docs/projects.md +++ b/docs/projects.md @@ -64,6 +64,7 @@ The following settings are available on iOS and Android: ```ts type IOSProjectParams = { sourceDir?: string; + unstable_reactLegacyComponentNames?: string[] | null; }; type AndroidProjectParams = { @@ -81,6 +82,18 @@ type AndroidProjectParams = { A path to a directory where iOS source files are located. In most cases, you shouldn't need to set it, unless you have multiple `Podfile` files in your project. +#### project.ios.unstable_reactLegacyComponentNames + +> Note: Only applicable when new architecture is turned on. + +Please note that this is part of the **Unstable Fabric Interop Layer**, and might be subject to breaking change in the future, +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 libraries that haven't been migrated yet on the New Architecture. + +The list should contain the name of the components, as they're registered in the ViewManagers (i.e. just `"Button"`). + #### project.android.appName A name of the app in the Android `sourceDir`, equivalent to Gradle project name. By default it's `app`. @@ -109,7 +122,7 @@ Please note that this is part of the **Unstable Fabric Interop Layer**, and migh 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. +This will allow you to use libraries that haven't been migrated yet on the New Architecture. The list should contain the name of the components, as they're registered in the ViewManagers (i.e. just `"Button"`). diff --git a/packages/cli-config/src/schema.ts b/packages/cli-config/src/schema.ts index 0af02626f2..5a7434c508 100644 --- a/packages/cli-config/src/schema.ts +++ b/packages/cli-config/src/schema.ts @@ -150,6 +150,10 @@ export const projectConfig = t // IOSProjectParams .object({ sourceDir: t.string(), + unstable_reactLegacyComponentNames: t + .array() + .items(t.string()) + .default([]), }) .default({}), android: t diff --git a/packages/cli-platform-ios/src/config/__tests__/getProjectConfig.test.ts b/packages/cli-platform-ios/src/config/__tests__/getProjectConfig.test.ts index 99b3b6b385..912f1b6b60 100644 --- a/packages/cli-platform-ios/src/config/__tests__/getProjectConfig.test.ts +++ b/packages/cli-platform-ios/src/config/__tests__/getProjectConfig.test.ts @@ -27,7 +27,6 @@ describe('ios::getProjectConfig', () => { Object { "sourceDir": "/ios", "xcodeProject": null, - } `); }); it('returns correct configuration when multiple Podfile are present', () => {