diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/NativeModuleRegistryBuilder.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/NativeModuleRegistryBuilder.java index ae0236890d0834..e270b8fbf661ae 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/NativeModuleRegistryBuilder.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/NativeModuleRegistryBuilder.java @@ -39,8 +39,7 @@ public void processPackage(ReactPackage reactPackage) { ((BaseReactPackage) reactPackage).getNativeModuleIterator(mReactApplicationContext); } else { moduleHolders = - ReactPackageHelper.getNativeModuleIterator( - reactPackage, mReactApplicationContext, mReactInstanceManager); + ReactPackageHelper.getNativeModuleIterator(reactPackage, mReactApplicationContext); } for (ModuleHolder moduleHolder : moduleHolders) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactInstancePackage.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactInstancePackage.java deleted file mode 100644 index 3d8634135c356d..00000000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactInstancePackage.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.facebook.react; - -import com.facebook.react.bridge.NativeModule; -import com.facebook.react.bridge.ReactApplicationContext; -import java.util.List; - -/** - * A simple wrapper for ReactPackage to make it aware of its {@link ReactInstanceManager} when - * creating native modules. This is useful when the package needs to ask the instance manager for - * more information, like {@link DevSupportManager}. - * - *

TODO(t11394819): Consolidate this with LazyReactPackage Use {@link ReactPackage} or {@link - * LazyReactPackage} and inject reactInstanceManager as a part of when plugins are initialized. - */ -@Deprecated -public abstract class ReactInstancePackage implements ReactPackage { - - public abstract List createNativeModules( - ReactApplicationContext reactContext, ReactInstanceManager reactInstanceManager); - - @Override - public List createNativeModules(ReactApplicationContext reactContext) { - throw new RuntimeException("ReactInstancePackage must be passed in the ReactInstanceManager."); - } -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactPackageHelper.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactPackageHelper.java index eb38ced52e1ca0..6b65e35afec4ba 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactPackageHelper.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactPackageHelper.java @@ -26,21 +26,13 @@ class ReactPackageHelper { */ /** package */ static Iterable getNativeModuleIterator( - ReactPackage reactPackage, - ReactApplicationContext reactApplicationContext, - ReactInstanceManager reactInstanceManager) { + ReactPackage reactPackage, ReactApplicationContext reactApplicationContext) { FLog.d( ReactConstants.TAG, reactPackage.getClass().getSimpleName() + " is not a LazyReactPackage, falling back to old version."); - final List nativeModules; - if (reactPackage instanceof ReactInstancePackage) { - ReactInstancePackage reactInstancePackage = (ReactInstancePackage) reactPackage; - nativeModules = - reactInstancePackage.createNativeModules(reactApplicationContext, reactInstanceManager); - } else { - nativeModules = reactPackage.createNativeModules(reactApplicationContext); - } + final List nativeModules = + reactPackage.createNativeModules(reactApplicationContext); return () -> new Iterator() { int position = 0; diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactPackageTurboModuleManagerDelegate.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactPackageTurboModuleManagerDelegate.java index 4c4334a3e32bcf..a872660e006438 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactPackageTurboModuleManagerDelegate.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactPackageTurboModuleManagerDelegate.java @@ -85,11 +85,6 @@ protected ReactPackageTurboModuleManagerDelegate( continue; } - if (shouldSupportLegacyPackages() && reactPackage instanceof ReactInstancePackage) { - // TODO(T145105887): Output error that ReactPackage was used - continue; - } - if (shouldSupportLegacyPackages()) { // TODO(T145105887): Output warnings that ReactPackage was used final List nativeModules =