Skip to content

Commit

Permalink
Fix lookup of ReactModuleInfoProvider for CoreReactPackage (facebook#…
Browse files Browse the repository at this point in the history
…41086)

Summary:
Pull Request resolved: facebook#41086

In this diff I'm fixing the lookup of ReactModuleInfoProvider instance for CoreReactPackage. It is searching for the wrong class.

changelog: [internal] internal

Reviewed By: RSNara

Differential Revision: D50338304

fbshipit-source-id: 840d1d018cc0f9df8a64fd09a851d8a87f5a1f15
  • Loading branch information
mdvacca authored and Othinn committed Oct 30, 2023
1 parent bbd7ce4 commit 6d705f3
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
})
class CoreReactPackage extends TurboReactPackage {

private DevSupportManager mDevSupportManager;
private DefaultHardwareBackBtnHandler mHardwareBackBtnHandler;
private final DevSupportManager mDevSupportManager;
private final DefaultHardwareBackBtnHandler mHardwareBackBtnHandler;

public CoreReactPackage(
DevSupportManager devSupportManager, DefaultHardwareBackBtnHandler hardwareBackBtnHandler) {
Expand Down Expand Up @@ -77,7 +77,7 @@ public NativeModule getModule(String name, ReactApplicationContext reactContext)
public ReactModuleInfoProvider getReactModuleInfoProvider() {
try {
Class<?> reactModuleInfoProviderClass =
Class.forName("com.facebook.react.CoreModulesPackage$$ReactModuleInfoProvider");
Class.forName(CoreReactPackage.class.getName() + "$$ReactModuleInfoProvider");
return (ReactModuleInfoProvider) reactModuleInfoProviderClass.newInstance();
} catch (ClassNotFoundException e) {
// In OSS case, the annotation processor does not run. We fall back on creating this byhand
Expand Down Expand Up @@ -109,10 +109,16 @@ public ReactModuleInfoProvider getReactModuleInfoProvider() {
return () -> reactModuleInfoMap;
} catch (InstantiationException e) {
throw new RuntimeException(
"No ReactModuleInfoProvider for CoreModulesPackage$$ReactModuleInfoProvider", e);
"No ReactModuleInfoProvider for "
+ CoreReactPackage.class.getName()
+ "$$ReactModuleInfoProvider",
e);
} catch (IllegalAccessException e) {
throw new RuntimeException(
"No ReactModuleInfoProvider for CoreModulesPackage$$ReactModuleInfoProvider", e);
"No ReactModuleInfoProvider for "
+ CoreReactPackage.class.getName()
+ "$$ReactModuleInfoProvider",
e);
}
}
}

0 comments on commit 6d705f3

Please sign in to comment.