Skip to content

Commit

Permalink
Add ExceptionsManagerModule for RNTester (#40767)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #40767

Fix the following issue:
```Invariant Violation: TurboModuleRegistry.getEnforcing(...):
'ExceptionsManager' could not be found. Verify that a module by this name is registered in the native
binary.Bridgeless mode: true. TurboModule interop: true. Modules loaded: {"NativeModules":[],"TurboModules":
["PlatformConstants","AppState","SourceCode","BlobModule","WebSocketModule","DevSettings","DevToolsSettingsManager","LogBox","Networking","Appearance","DevLoadingView","DeviceInfo","DeviceEventManager",
"SoundManager","ImageLoader","DialogManagerAndroid","NativeAnimatedModule","I18nManager","AccessibilityInfo","StatusBarManager","StatusBarManager","IntentAndroid","ToastAndroid","ShareModule","Vibration"],
"NotFound":["NativePerformanceCxx","NativePerformanceObserverCxx","RedBox","BugReporting","HeadlessJsTaskSupport","FrameRateLogger","KeyboardObserver",
"AccessibilityManager","ModalManager","LinkingManager","ActionSheetManager","ExceptionsManager"]}
```

Changelog:
[Android][Changed] - Add Add ExceptionsManagerModule to CoreReactPackage

Reviewed By: cortinico

Differential Revision: D50017783

fbshipit-source-id: 8642bb23bdae50a1e702f5e0586b0ede80007bb1
  • Loading branch information
Lulu Wu authored and facebook-github-bot committed Oct 11, 2023
1 parent 0004888 commit 4d70337
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Expand Up @@ -20,6 +20,7 @@
import com.facebook.react.module.model.ReactModuleInfoProvider;
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
import com.facebook.react.modules.core.DeviceEventManagerModule;
import com.facebook.react.modules.core.ExceptionsManagerModule;
import com.facebook.react.modules.debug.DevSettingsModule;
import com.facebook.react.modules.debug.SourceCodeModule;
import com.facebook.react.modules.deviceinfo.DeviceInfoModule;
Expand All @@ -36,6 +37,7 @@
SourceCodeModule.class,
LogBoxModule.class,
DeviceEventManagerModule.class,
ExceptionsManagerModule.class,
})
class CoreReactPackage extends TurboReactPackage {

Expand Down Expand Up @@ -63,6 +65,8 @@ public NativeModule getModule(String name, ReactApplicationContext reactContext)
return new DeviceEventManagerModule(reactContext, mHardwareBackBtnHandler);
case LogBoxModule.NAME:
return new LogBoxModule(reactContext, mDevSupportManager);
case ExceptionsManagerModule.NAME:
return new ExceptionsManagerModule(mDevSupportManager);
default:
throw new IllegalArgumentException(
"In BridgelessReactPackage, could not find Native module for " + name);
Expand All @@ -85,6 +89,7 @@ public ReactModuleInfoProvider getReactModuleInfoProvider() {
DevSettingsModule.class,
DeviceEventManagerModule.class,
LogBoxModule.class,
ExceptionsManagerModule.class,
};
final Map<String, ReactModuleInfo> reactModuleInfoMap = new HashMap<>();
for (Class<? extends NativeModule> moduleClass : moduleList) {
Expand Down
Expand Up @@ -39,9 +39,6 @@ import com.facebook.soloader.SoLoader

class RNTesterApplication : Application(), ReactApplication {
override val reactNativeHost: ReactNativeHost by lazy {
if (ReactFeatureFlags.enableBridgelessArchitecture) {
throw RuntimeException("Should not use ReactNativeHost when Bridgeless enabled")
}
object : DefaultReactNativeHost(this) {
public override fun getJSMainModuleName(): String = BuildConfig.JS_MAIN_MODULE_NAME

Expand Down

0 comments on commit 4d70337

Please sign in to comment.