Skip to content

Commit

Permalink
Fix DefaultReactNativeHost assuming lazyViewManagers are always avail…
Browse files Browse the repository at this point in the history
…able (#43334)

Summary:
Pull Request resolved: #43334

cortinico flagged that bridge + fabric regressed in 0.74, likely due to D53406841.

Changelog: [Android][Fixed] Fix registration of ViewManagers in new renderer when not using lazyViewManagers.

Reviewed By: fkgozali

Differential Revision: D54551645

fbshipit-source-id: 0783030cd0d2900a3a254ae04c9ea4e51035272a
  • Loading branch information
javache authored and facebook-github-bot committed Mar 6, 2024
1 parent e4f3338 commit fb9872d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -998,6 +998,11 @@ public Collection<String> 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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit fb9872d

Please sign in to comment.