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
This commit is contained in:
David Vacca
2023-10-01 15:38:07 -07:00
committed by Facebook GitHub Bot
parent d95433f824
commit 294c0fa208
3 changed files with 10 additions and 4 deletions
@@ -26,7 +26,12 @@ import java.util.Set;
/**
* {@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<ReactPackage> mChildReactPackages = new ArrayList<>();
@@ -95,11 +95,8 @@ public abstract class LazyReactPackage implements ReactPackage {
protected abstract List<ModuleSpec> 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<NativeModule>} to register
*/
@Override
public final List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
@@ -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)