diff --git a/packages/react-native/ReactAndroid/api/ReactAndroid.api b/packages/react-native/ReactAndroid/api/ReactAndroid.api index 568af79cf2a377..4352458aa0ec14 100644 --- a/packages/react-native/ReactAndroid/api/ReactAndroid.api +++ b/packages/react-native/ReactAndroid/api/ReactAndroid.api @@ -29,6 +29,15 @@ public class com/facebook/react/CoreModulesPackage$$ReactModuleInfoProvider : co public fun getReactModuleInfos ()Ljava/util/Map; } +public class com/facebook/react/DebugCorePackage : com/facebook/react/TurboReactPackage, com/facebook/react/ViewManagerOnDemandReactPackage { + public fun ()V + public fun createViewManager (Lcom/facebook/react/bridge/ReactApplicationContext;Ljava/lang/String;)Lcom/facebook/react/uimanager/ViewManager; + public fun getModule (Ljava/lang/String;Lcom/facebook/react/bridge/ReactApplicationContext;)Lcom/facebook/react/bridge/NativeModule; + public fun getReactModuleInfoProvider ()Lcom/facebook/react/module/model/ReactModuleInfoProvider; + public fun getViewManagerNames (Lcom/facebook/react/bridge/ReactApplicationContext;)Ljava/util/Collection; + public fun getViewManagers (Lcom/facebook/react/bridge/ReactApplicationContext;)Ljava/util/List; +} + public class com/facebook/react/DebugCorePackage$$ReactModuleInfoProvider : com/facebook/react/module/model/ReactModuleInfoProvider { public fun ()V public fun getReactModuleInfos ()Ljava/util/Map; diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/DebugCorePackage.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/DebugCorePackage.java index 2e1d3d976cdf3b..b695c937dbc63e 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/DebugCorePackage.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/DebugCorePackage.java @@ -36,7 +36,7 @@ JSCHeapCapture.class, }) /* package */ -class DebugCorePackage extends TurboReactPackage implements ViewManagerOnDemandReactPackage { +public class DebugCorePackage extends TurboReactPackage implements ViewManagerOnDemandReactPackage { private @Nullable Map mViewManagers; public DebugCorePackage() {} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactInstance.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactInstance.java index 80793f45f01819..7f241ce4d7fc58 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactInstance.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactInstance.java @@ -15,6 +15,7 @@ import com.facebook.infer.annotation.ThreadSafe; import com.facebook.jni.HybridData; import com.facebook.proguard.annotations.DoNotStrip; +import com.facebook.react.DebugCorePackage; import com.facebook.react.ReactPackage; import com.facebook.react.ViewManagerOnDemandReactPackage; import com.facebook.react.bridge.Arguments; @@ -195,6 +196,9 @@ public void onHostDestroy() { new CoreReactPackage( bridgelessReactContext.getDevSupportManager(), bridgelessReactContext.getDefaultHardwareBackBtnHandler())); + if (useDevSupport) { + mReactPackages.add(new DebugCorePackage()); + } mReactPackages.addAll(mDelegate.getReactPackages()); TurboModuleManagerDelegate turboModuleManagerDelegate = diff --git a/packages/rn-tester/android/app/src/main/java/com/facebook/react/uiapp/RNTesterApplication.kt b/packages/rn-tester/android/app/src/main/java/com/facebook/react/uiapp/RNTesterApplication.kt index 01756aea982108..8d863a242ca2cf 100644 --- a/packages/rn-tester/android/app/src/main/java/com/facebook/react/uiapp/RNTesterApplication.kt +++ b/packages/rn-tester/android/app/src/main/java/com/facebook/react/uiapp/RNTesterApplication.kt @@ -111,11 +111,13 @@ class RNTesterApplication : Application(), ReactApplication { override fun createViewManager( reactContext: ReactApplicationContext, viewManagerName: String - ): ViewManager<*, out ReactShadowNode<*>> = + ): ViewManager<*, out ReactShadowNode<*>>? = if (viewManagerName == "RNTMyNativeView") { MyNativeViewManager() - } else { + } else if (viewManagerName == "RNTMyLegacyNativeView") { MyLegacyViewManager(reactContext) + } else { + null } }) }