diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java index a600833e264a4a..7258ab91f4dbc1 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java @@ -998,6 +998,11 @@ public Collection getViewManagerNames() { if (names != null) { uniqueNames.addAll(names); } + } else { + FLog.w( + ReactConstants.TAG, + "Package %s is not a ViewManagerOnDemandReactPackage, view managers will not be loaded", + reactPackage.getClass().getSimpleName()); } Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE); } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactNativeHost.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactNativeHost.kt index da82f02ea68262..817e953d0de25f 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactNativeHost.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactNativeHost.kt @@ -49,13 +49,18 @@ protected constructor( DefaultComponentsRegistry.register(componentFactory) val viewManagerRegistry = - ViewManagerRegistry( - object : ViewManagerResolver { - override fun getViewManager(viewManagerName: String) = - reactInstanceManager.createViewManager(viewManagerName) + if (lazyViewManagersEnabled) { + ViewManagerRegistry( + object : ViewManagerResolver { + override fun getViewManager(viewManagerName: String) = + reactInstanceManager.createViewManager(viewManagerName) - override fun getViewManagerNames() = reactInstanceManager.viewManagerNames - }) + override fun getViewManagerNames() = reactInstanceManager.viewManagerNames + }) + } else { + ViewManagerRegistry( + reactInstanceManager.getOrCreateViewManagers(reactApplicationContext)) + } FabricUIManagerProviderImpl( componentFactory, ReactNativeConfig.DEFAULT_CONFIG, viewManagerRegistry)