getModule API may return null module

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
This commit is contained in:
Xin Chen
2022-07-19 22:30:29 -07:00
committed by Facebook GitHub Bot
parent b66db7a840
commit 8a33b75f55
@@ -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;
@@ -42,7 +43,8 @@ public abstract class TurboReactPackage implements ReactPackage {
* @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