Skip to content

Commit

Permalink
Finish lazilyLoadView
Browse files Browse the repository at this point in the history
Summary:
This API was used by the old architecture to lazily register/load components:
1. Load a ViewManager's class from the disk
2. Register the ViewManager's class with React Native

See: [RCTUIManager lazilyLoadView](https://github.com/facebook/react-native/blob/822bf52c29729d25b2bfb31655cf773609a9283d/packages/react-native/React/Modules/RCTUIManager.m#L1546-L1591)

The new architecture **does not** support lazy loading of **legacy** modules/components.

Therefore, let's leave this API unimplemented until we decide to implement lazy loading of legacy stuff in new architecture.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D52677515

fbshipit-source-id: 8d49a0b54f901a3e9b3e8a9578ebb0c81de522d8
  • Loading branch information
RSNara authored and facebook-github-bot committed Jan 26, 2024
1 parent 3c6c282 commit 4636029
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,11 @@ const UIManagerJSPlatformAPIs = Platform.select({
},
},
ios: {
/**
* TODO(T174674274): Implement lazy loading of legacy view managers in the new architecture.
*
* Leave this unimplemented until we implement lazy loading of legacy modules and view managers in the new architecture.
*/
lazilyLoadView: (name: string): Object => {
raiseSoftError('lazilyLoadView');
return {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ + (BOOL)isSupported:(NSString *)componentName
}

// Step 3: check if the module has been registered
// TODO(T174674274): Implement lazy loading of legacy view managers in the new architecture.
NSArray<Class> *registeredModules = RCTGetModuleClasses();
NSMutableDictionary<NSString *, Class> *supportedLegacyViewComponents =
[RCTLegacyViewManagerInteropComponentView _supportedLegacyViewComponents];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ - (BOOL)registerComponentIfPossible:(const std::string &)name
}

// Fallback 3: Try to use Paper Interop.
// TODO(T174674274): Implement lazy loading of legacy view managers in the new architecture.
if (RCTFabricInteropLayerEnabled() && [RCTLegacyViewManagerInteropComponentView isSupported:componentNameString]) {
RCTLogNewArchitectureValidation(
RCTNotAllowedInBridgeless,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge
}

if (RCTTurboModuleInteropEnabled()) {
// TODO(T174674274): Implement lazy loading of legacy modules in the new architecture.
NSMutableDictionary<NSString *, id<RCTBridgeModule>> *legacyInitializedModules = [NSMutableDictionary new];

if ([_delegate respondsToSelector:@selector(extraModulesForBridge:)]) {
Expand Down

0 comments on commit 4636029

Please sign in to comment.