mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Customize ExceptionHandler in ReactAppTestActivity
Summary: This diff extends the ReactAppTestActivity to allow customization of the RN ExceptionHandler Changelog: This diff extends the ReactAppTestActivity to allow customization of the RN ExceptionHandler Reviewed By: JoshuaGross Differential Revision: D17993132 fbshipit-source-id: 7320d35a4d88d56a7356f2863829c88758c08341
This commit is contained in:
committed by
Facebook Github Bot
parent
8425292eb4
commit
3408dc0b3e
@@ -207,6 +207,10 @@ public class ReactAppTestActivity extends FragmentActivity
|
||||
if (spec.getJavaScriptExecutorFactory() != null) {
|
||||
builder.setJavaScriptExecutorFactory(spec.getJavaScriptExecutorFactory());
|
||||
}
|
||||
if (spec.getNativeModuleCallExceptionHandler() != null) {
|
||||
builder.setNativeModuleCallExceptionHandler(spec.getNativeModuleCallExceptionHandler());
|
||||
}
|
||||
|
||||
if (!spec.getAlternativeReactPackagesForTest().isEmpty()) {
|
||||
builder.addPackages(spec.getAlternativeReactPackagesForTest());
|
||||
} else {
|
||||
|
||||
+12
@@ -13,6 +13,7 @@ import com.facebook.react.ReactPackage;
|
||||
import com.facebook.react.bridge.JavaScriptExecutorFactory;
|
||||
import com.facebook.react.bridge.JavaScriptModule;
|
||||
import com.facebook.react.bridge.NativeModule;
|
||||
import com.facebook.react.bridge.NativeModuleCallExceptionHandler;
|
||||
import com.facebook.react.uimanager.ViewManager;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -31,6 +32,7 @@ public class ReactInstanceSpecForTest {
|
||||
private final List<Class<? extends JavaScriptModule>> mJSModuleSpecs = new ArrayList<>();
|
||||
private final List<ViewManager> mViewManagers = new ArrayList<>();
|
||||
private final ArrayList<ReactPackage> mReactPackages = new ArrayList<>();
|
||||
@Nullable private NativeModuleCallExceptionHandler mNativeModuleCallExceptionHandler = null;
|
||||
@Nullable private FabricUIManagerFactory mFabricUIManagerFactory = null;
|
||||
@Nullable private JavaScriptExecutorFactory mJavaScriptExecutorFactory = null;
|
||||
|
||||
@@ -39,6 +41,16 @@ public class ReactInstanceSpecForTest {
|
||||
return this;
|
||||
}
|
||||
|
||||
public ReactInstanceSpecForTest setNativeModuleCallExceptionHandler(
|
||||
NativeModuleCallExceptionHandler nativeModuleCallExceptionHandler) {
|
||||
mNativeModuleCallExceptionHandler = nativeModuleCallExceptionHandler;
|
||||
return this;
|
||||
}
|
||||
|
||||
public NativeModuleCallExceptionHandler getNativeModuleCallExceptionHandler() {
|
||||
return mNativeModuleCallExceptionHandler;
|
||||
}
|
||||
|
||||
public ReactInstanceSpecForTest setJavaScriptExecutorFactory(
|
||||
JavaScriptExecutorFactory javaScriptExecutorFactory) {
|
||||
mJavaScriptExecutorFactory = javaScriptExecutorFactory;
|
||||
|
||||
Reference in New Issue
Block a user