Skip to content

Commit

Permalink
getModule API may return null module
Browse files Browse the repository at this point in the history
Summary:
The native module might be null, and that should not be an exception thrown by the subclassed method.

Changelog:
[Android][Internal] - Mark getModule API to be nullable

Reviewed By: mdvacca, makovkastar

Differential Revision: D37900294

fbshipit-source-id: a4ecc9804b95bf0512554e96985f272b435e33b2
  • Loading branch information
ryancat authored and facebook-github-bot committed Jul 20, 2022
1 parent b66db7a commit 8a33b75
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
package com.facebook.react;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ModuleHolder;
import com.facebook.react.bridge.ModuleSpec;
import com.facebook.react.bridge.NativeModule;
Expand Down Expand Up @@ -42,7 +43,8 @@ public List<NativeModule> createNativeModules(ReactApplicationContext reactConte
* @param reactContext
* @return
*/
public abstract NativeModule getModule(String name, final ReactApplicationContext reactContext);
public abstract @Nullable NativeModule getModule(
String name, final ReactApplicationContext reactContext);

/**
* This is a temporary method till we implement TurboModules. Once we implement TurboModules, we
Expand Down

0 comments on commit 8a33b75

Please sign in to comment.