Skip to content

Commit

Permalink
Make TurboReactPackage.getModule no nullable (#39140)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #39140

TurboReactPackage.getModule is nullable, although the internals of ReactNative requires this method to be non null (otherwise there will a NPEs)
I'm making TurboReactPackage.getModule no nullable, this is important to simplify API and future migration to kotlin

changelog: [internal] internal/

Reviewed By: cortinico

Differential Revision: D48588375

fbshipit-source-id: e510f76ea0271ff33ab2ebe6c76382c4781e1787
  • Loading branch information
mdvacca authored and facebook-github-bot committed Aug 24, 2023
1 parent 42a7777 commit 7eacf27
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ public List<NativeModule> createNativeModules(ReactApplicationContext reactConte
* @param name name of the Native Module
* @param reactContext {@link ReactApplicationContext} context for this
*/
public abstract @Nullable NativeModule getModule(
String name, final ReactApplicationContext reactContext);
public abstract NativeModule getModule(String name, final ReactApplicationContext reactContext);

/**
* This is a temporary method till we implement TurboModules. Once we implement TurboModules, we
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public MainReactPackage(MainPackageConfig config) {
}

@Override
public @Nullable NativeModule getModule(String name, ReactApplicationContext context) {
public NativeModule getModule(String name, ReactApplicationContext context) {
switch (name) {
case AccessibilityInfoModule.NAME:
return new AccessibilityInfoModule(context);
Expand Down Expand Up @@ -151,7 +151,8 @@ public MainReactPackage(MainPackageConfig config) {
case DevToolsSettingsManagerModule.NAME:
return new DevToolsSettingsManagerModule(context);
default:
return null;
throw new IllegalArgumentException(
"Could not find Native module for " + name + " in MainReactPackage.");
}
}

Expand Down

0 comments on commit 7eacf27

Please sign in to comment.