From 294c0fa208a5eac201c9b9b79dee73a852b62aa8 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Sun, 1 Oct 2023 15:38:07 -0700 Subject: [PATCH] Deprecate CompositeReactPackage (#39565) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/39565 CompositeReactPackage is not used at Meta neither in github public repositories, we are deprecating it in v0.73 with the goal to remove it in v0.74 changelog: [Android][Breaking] Deprecate CompositeReactPackage from RN Android Reviewed By: christophpurrer Differential Revision: D49440130 fbshipit-source-id: 6a9c220f57fd29f7a530db79c4f76ef169744fba --- .../main/java/com/facebook/react/CompositeReactPackage.java | 5 +++++ .../src/main/java/com/facebook/react/LazyReactPackage.java | 5 +---- .../java/com/facebook/react/CompositeReactPackageTest.kt | 4 ++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/CompositeReactPackage.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/CompositeReactPackage.java index 3cae5492de17ec..f14616d8a3bb87 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/CompositeReactPackage.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/CompositeReactPackage.java @@ -26,7 +26,12 @@ /** * {@code CompositeReactPackage} allows to create a single package composed of views and modules * from several other packages. + * + * @deprecated */ +@Deprecated( + since = "CompositeReactPackage is deprecated and will be deleted, use ReactPackage instead", + forRemoval = true) public class CompositeReactPackage implements ViewManagerOnDemandReactPackage, ReactPackage { private final List mChildReactPackages = new ArrayList<>(); diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/LazyReactPackage.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/LazyReactPackage.java index 570d1a2f89b8db..98a013d135ebdd 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/LazyReactPackage.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/LazyReactPackage.java @@ -95,11 +95,8 @@ public void remove() { protected abstract List getNativeModules(ReactApplicationContext reactContext); /** - * This is only used when a LazyReactPackage is a part of {@link CompositeReactPackage} Once we - * deprecate {@link CompositeReactPackage}, this can be removed too - * * @param reactContext react application context that can be used to create modules - * @return + * @return {@link List} to register */ @Override public final List createNativeModules(ReactApplicationContext reactContext) { diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/CompositeReactPackageTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/CompositeReactPackageTest.kt index 88c84b938c0cc0..c20a7c4d5acf24 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/CompositeReactPackageTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/CompositeReactPackageTest.kt @@ -37,6 +37,7 @@ class CompositeReactPackageTest { } @Test + @Suppress("DEPRECATION") fun testThatCreateNativeModulesIsCalledOnAllPackages() { // Given val composite = CompositeReactPackage(packageNo1, packageNo2, packageNo3) @@ -51,6 +52,7 @@ class CompositeReactPackageTest { } @Test + @Suppress("DEPRECATION") fun testThatCreateViewManagersIsCalledOnAllPackages() { // Given val composite = CompositeReactPackage(packageNo1, packageNo2, packageNo3) @@ -65,6 +67,7 @@ class CompositeReactPackageTest { } @Test + @Suppress("DEPRECATION") fun testThatCompositeReturnsASumOfNativeModules() { // Given val composite = CompositeReactPackage(packageNo1, packageNo2) @@ -95,6 +98,7 @@ class CompositeReactPackageTest { } @Test + @Suppress("DEPRECATION") fun testThatCompositeReturnsASumOfViewManagers() { // Given val composite = CompositeReactPackage(packageNo1, packageNo2)