Java 类com.facebook.react.bridge.NativeModuleCallExceptionHandler 实例源码

项目:ReactNativeSignatureExample    文件:ReactTestHelper.java   
@Override
public CatalystInstance build() {
  return new CatalystInstanceImpl.Builder()
    .setReactQueueConfigurationSpec(ReactQueueConfigurationSpec.createDefault())
    .setJSExecutor(new JSCJavaScriptExecutor(new WritableNativeMap()))
    .setRegistry(mNativeModuleRegistryBuilder.build())
    .setJSModulesConfig(mJSModulesConfigBuilder.build())
    .setJSBundleLoader(JSBundleLoader.createFileLoader(
                         mContext,
                         "assets://AndroidTestBundle.js"))
    .setNativeModuleCallExceptionHandler(
      new NativeModuleCallExceptionHandler() {
          @Override
          public void handleException(Exception e) {
            throw new RuntimeException(e);
          }
      })
    .build();
}
项目:react-native-ibeacon-android    文件:ReactTestHelper.java   
@Override
public CatalystInstance build() {
  return new CatalystInstanceImpl.Builder()
    .setReactQueueConfigurationSpec(ReactQueueConfigurationSpec.createDefault())
    .setJSExecutor(new JSCJavaScriptExecutor(new WritableNativeMap()))
    .setRegistry(mNativeModuleRegistryBuilder.build())
    .setJSModulesConfig(mJSModulesConfigBuilder.build())
    .setJSBundleLoader(JSBundleLoader.createFileLoader(
                         mContext,
                         "assets://AndroidTestBundle.js"))
    .setNativeModuleCallExceptionHandler(
      new NativeModuleCallExceptionHandler() {
          @Override
          public void handleException(Exception e) {
            throw new RuntimeException(e);
          }
      })
    .build();
}
项目:react-native-box-loaders    文件:ReactTestHelper.java   
@Override
public CatalystInstance build() {
  return new CatalystInstanceImpl.Builder()
    .setReactQueueConfigurationSpec(ReactQueueConfigurationSpec.createDefault())
    .setJSExecutor(new JSCJavaScriptExecutor(new WritableNativeMap()))
    .setRegistry(mNativeModuleRegistryBuilder.build())
    .setJSModulesConfig(mJSModulesConfigBuilder.build())
    .setJSBundleLoader(JSBundleLoader.createFileLoader(
                         mContext,
                         "assets://AndroidTestBundle.js"))
    .setNativeModuleCallExceptionHandler(
      new NativeModuleCallExceptionHandler() {
          @Override
          public void handleException(Exception e) {
            throw new RuntimeException(e);
          }
      })
    .build();
}
项目:react-native-threads    文件:ReactContextBuilder.java   
private NativeModuleCallExceptionHandler createNativeModuleExceptionHandler() {
    return new NativeModuleCallExceptionHandler() {
        @Override
        public void handleException(Exception e) {
            throw new RuntimeException(e);
        }
    };
}
项目:RNLearn_Project1    文件:CatalystInstanceImpl.java   
private CatalystInstanceImpl(
    final ReactQueueConfigurationSpec ReactQueueConfigurationSpec,
    final JavaScriptExecutor jsExecutor,
    final NativeModuleRegistry registry,
    final JavaScriptModuleRegistry jsModuleRegistry,
    final JSBundleLoader jsBundleLoader,
    NativeModuleCallExceptionHandler nativeModuleCallExceptionHandler) {
  FLog.d(ReactConstants.TAG, "Initializing React Xplat Bridge.");
  mHybridData = initHybrid();

  mReactQueueConfiguration = ReactQueueConfigurationImpl.create(
      ReactQueueConfigurationSpec,
      new NativeExceptionHandler());
  mBridgeIdleListeners = new CopyOnWriteArrayList<>();
  mJavaRegistry = registry;
  mJSModuleRegistry = jsModuleRegistry;
  mJSBundleLoader = jsBundleLoader;
  mNativeModuleCallExceptionHandler = nativeModuleCallExceptionHandler;
  mNativeModulesQueueThread = mReactQueueConfiguration.getNativeModulesQueueThread();
  mTraceListener = new JSProfilerTraceListener(this);

  FLog.d(ReactConstants.TAG, "Initializing React Xplat Bridge before initializeBridge");
  initializeBridge(
    new BridgeCallback(this),
    jsExecutor,
    mReactQueueConfiguration.getJSQueueThread(),
    mNativeModulesQueueThread,
    mJavaRegistry.getJavaModules(this),
    mJavaRegistry.getCxxModules());
  FLog.d(ReactConstants.TAG, "Initializing React Xplat Bridge after initializeBridge");
  mMainExecutorToken = getMainExecutorToken();
}
项目:RNLearn_Project1    文件:CatalystInstanceImpl.java   
private CatalystInstanceImpl(
    final ReactQueueConfigurationSpec ReactQueueConfigurationSpec,
    final JavaScriptExecutor jsExecutor,
    final NativeModuleRegistry registry,
    final JavaScriptModuleRegistry jsModuleRegistry,
    final JSBundleLoader jsBundleLoader,
    NativeModuleCallExceptionHandler nativeModuleCallExceptionHandler) {
  FLog.w(ReactConstants.TAG, "Initializing React Xplat Bridge.");
  mHybridData = initHybrid();

  mReactQueueConfiguration = ReactQueueConfigurationImpl.create(
      ReactQueueConfigurationSpec,
      new NativeExceptionHandler());
  mBridgeIdleListeners = new CopyOnWriteArrayList<>();
  mJavaRegistry = registry;
  mJSModuleRegistry = jsModuleRegistry;
  mJSBundleLoader = jsBundleLoader;
  mNativeModuleCallExceptionHandler = nativeModuleCallExceptionHandler;
  mNativeModulesQueueThread = mReactQueueConfiguration.getNativeModulesQueueThread();
  mTraceListener = new JSProfilerTraceListener(this);

  FLog.w(ReactConstants.TAG, "Initializing React Xplat Bridge before initializeBridge");
  initializeBridge(
    new BridgeCallback(this),
    jsExecutor,
    mReactQueueConfiguration.getJSQueueThread(),
    mNativeModulesQueueThread,
    mJavaRegistry.getJavaModules(this),
    mJavaRegistry.getCxxModules());
  FLog.w(ReactConstants.TAG, "Initializing React Xplat Bridge after initializeBridge");
  mMainExecutorToken = getMainExecutorToken();
}
项目:ReactNativeSignatureExample    文件:ReactInstanceManagerImpl.java   
ReactInstanceManagerImpl(
    Context applicationContext,
    @Nullable String jsBundleFile,
    @Nullable String jsMainModuleName,
    List<ReactPackage> packages,
    boolean useDeveloperSupport,
    @Nullable NotThreadSafeBridgeIdleDebugListener bridgeIdleDebugListener,
    LifecycleState initialLifecycleState,
    UIImplementationProvider uiImplementationProvider,
    NativeModuleCallExceptionHandler nativeModuleCallExceptionHandler,
    @Nullable JSCConfig jscConfig) {
  initializeSoLoaderIfNecessary(applicationContext);

  // TODO(9577825): remove this
  ApplicationHolder.setApplication((Application) applicationContext.getApplicationContext());
  setDisplayMetrics(applicationContext);

  mApplicationContext = applicationContext;
  mJSBundleFile = jsBundleFile;
  mJSMainModuleName = jsMainModuleName;
  mPackages = packages;
  mUseDeveloperSupport = useDeveloperSupport;
  mDevSupportManager = DevSupportManagerFactory.create(
      applicationContext,
      mDevInterface,
      mJSMainModuleName,
      useDeveloperSupport);
  mBridgeIdleDebugListener = bridgeIdleDebugListener;
  mLifecycleState = initialLifecycleState;
  mUIImplementationProvider = uiImplementationProvider;
  mMemoryPressureRouter = new MemoryPressureRouter(applicationContext);
  mNativeModuleCallExceptionHandler = nativeModuleCallExceptionHandler;
  mJSCConfig = jscConfig;
}
项目:react-native-workers    文件:ReactContextBuilder.java   
private NativeModuleCallExceptionHandler createNativeModuleExceptionHandler() {
    return new NativeModuleCallExceptionHandler() {
        @Override
        public void handleException(Exception e) {
            throw new RuntimeException(e);
        }
    };
}
项目:react-native-ibeacon-android    文件:ReactInstanceManagerImpl.java   
ReactInstanceManagerImpl(
    Context applicationContext,
    @Nullable String jsBundleFile,
    @Nullable String jsMainModuleName,
    List<ReactPackage> packages,
    boolean useDeveloperSupport,
    @Nullable NotThreadSafeBridgeIdleDebugListener bridgeIdleDebugListener,
    LifecycleState initialLifecycleState,
    UIImplementationProvider uiImplementationProvider,
    NativeModuleCallExceptionHandler nativeModuleCallExceptionHandler,
    @Nullable JSCConfig jscConfig) {
  initializeSoLoaderIfNecessary(applicationContext);

  // TODO(9577825): remove this
  ApplicationHolder.setApplication((Application) applicationContext.getApplicationContext());
  setDisplayMetrics(applicationContext);

  mApplicationContext = applicationContext;
  mJSBundleFile = jsBundleFile;
  mJSMainModuleName = jsMainModuleName;
  mPackages = packages;
  mUseDeveloperSupport = useDeveloperSupport;
  mDevSupportManager = DevSupportManagerFactory.create(
      applicationContext,
      mDevInterface,
      mJSMainModuleName,
      useDeveloperSupport);
  mBridgeIdleDebugListener = bridgeIdleDebugListener;
  mLifecycleState = initialLifecycleState;
  mUIImplementationProvider = uiImplementationProvider;
  mMemoryPressureRouter = new MemoryPressureRouter(applicationContext);
  mNativeModuleCallExceptionHandler = nativeModuleCallExceptionHandler;
  mJSCConfig = jscConfig;
}
项目:react-native-box-loaders    文件:ReactInstanceManagerImpl.java   
ReactInstanceManagerImpl(
    Context applicationContext,
    @Nullable Activity currentActivity,
    @Nullable DefaultHardwareBackBtnHandler defaultHardwareBackBtnHandler,
    @Nullable String jsBundleFile,
    @Nullable String jsMainModuleName,
    List<ReactPackage> packages,
    boolean useDeveloperSupport,
    @Nullable NotThreadSafeBridgeIdleDebugListener bridgeIdleDebugListener,
    LifecycleState initialLifecycleState,
    UIImplementationProvider uiImplementationProvider,
    NativeModuleCallExceptionHandler nativeModuleCallExceptionHandler,
    @Nullable JSCConfig jscConfig) {
  initializeSoLoaderIfNecessary(applicationContext);

  // TODO(9577825): remove this
  ApplicationHolder.setApplication((Application) applicationContext.getApplicationContext());
  setDisplayMetrics(applicationContext);

  mApplicationContext = applicationContext;
  mCurrentActivity = currentActivity;
  mDefaultBackButtonImpl = defaultHardwareBackBtnHandler;
  mJSBundleFile = jsBundleFile;
  mJSMainModuleName = jsMainModuleName;
  mPackages = packages;
  mUseDeveloperSupport = useDeveloperSupport;
  mDevSupportManager = DevSupportManagerFactory.create(
      applicationContext,
      mDevInterface,
      mJSMainModuleName,
      useDeveloperSupport);
  mBridgeIdleDebugListener = bridgeIdleDebugListener;
  mLifecycleState = initialLifecycleState;
  mUIImplementationProvider = uiImplementationProvider;
  mMemoryPressureRouter = new MemoryPressureRouter(applicationContext);
  mNativeModuleCallExceptionHandler = nativeModuleCallExceptionHandler;
  mJSCConfig = jscConfig;
}
项目:Ironman    文件:CatalystInstanceImpl.java   
private CatalystInstanceImpl(
    final ReactQueueConfigurationSpec ReactQueueConfigurationSpec,
    final JavaScriptExecutor jsExecutor,
    final NativeModuleRegistry registry,
    final JavaScriptModuleRegistry jsModuleRegistry,
    final JSBundleLoader jsBundleLoader,
    NativeModuleCallExceptionHandler nativeModuleCallExceptionHandler) {
  FLog.d(ReactConstants.TAG, "Initializing React Xplat Bridge.");
  mHybridData = initHybrid();

  mReactQueueConfiguration = ReactQueueConfigurationImpl.create(
      ReactQueueConfigurationSpec,
      new NativeExceptionHandler());
  mBridgeIdleListeners = new CopyOnWriteArrayList<>();
  mJavaRegistry = registry;
  mJSModuleRegistry = jsModuleRegistry;
  mJSBundleLoader = jsBundleLoader;
  mNativeModuleCallExceptionHandler = nativeModuleCallExceptionHandler;
  mTraceListener = new JSProfilerTraceListener(this);

  initializeBridge(
    new BridgeCallback(this),
    jsExecutor,
    mReactQueueConfiguration.getJSQueueThread(),
    mReactQueueConfiguration.getNativeModulesQueueThread(),
    mJavaRegistry.getModuleRegistryHolder(this));
  mMainExecutorToken = getMainExecutorToken();
}
项目:react-native-exceptions-manager    文件:ExceptionsManagerModule.java   
public ExceptionsManagerModule(ReactApplicationContext reactContext) {
    super(reactContext);
    this.context = reactContext;

    reactContext.setNativeModuleCallExceptionHandler(new NativeModuleCallExceptionHandler() {
        @Override
        public void handleException(Exception e) {
            Intent intent = new Intent();
            intent.setAction("com.richardcao.android.REACT_NATIVE_CRASH_REPORT_ACTION");
            intent.putExtra("Exception", e);
            context.sendBroadcast(intent);
        }
    });
}
项目:RNLearn_Project1    文件:ReactInstanceManager.java   
ReactInstanceManager(
  Context applicationContext,
  @Nullable Activity currentActivity,
  @Nullable DefaultHardwareBackBtnHandler defaultHardwareBackBtnHandler,
  @Nullable JSBundleLoader bundleLoader,
  @Nullable String jsMainModuleName,
  List<ReactPackage> packages,
  boolean useDeveloperSupport,
  @Nullable NotThreadSafeBridgeIdleDebugListener bridgeIdleDebugListener,
  LifecycleState initialLifecycleState,
  UIImplementationProvider uiImplementationProvider,
  NativeModuleCallExceptionHandler nativeModuleCallExceptionHandler,
  JSCConfig jscConfig,
  @Nullable RedBoxHandler redBoxHandler,
  boolean lazyNativeModulesEnabled,
  boolean lazyViewManagersEnabled,
  boolean useStartupThread) {

  initializeSoLoaderIfNecessary(applicationContext);

  // TODO(9577825): remove this
  ApplicationHolder.setApplication((Application) applicationContext.getApplicationContext());
  DisplayMetricsHolder.initDisplayMetricsIfNotInitialized(applicationContext);

  mApplicationContext = applicationContext;
  mCurrentActivity = currentActivity;
  mDefaultBackButtonImpl = defaultHardwareBackBtnHandler;
  mBundleLoader = bundleLoader;
  mJSMainModuleName = jsMainModuleName;
  mPackages = packages;
  mUseDeveloperSupport = useDeveloperSupport;
  mDevSupportManager = DevSupportManagerFactory.create(
      applicationContext,
      mDevInterface,
      mJSMainModuleName,
      useDeveloperSupport,
      redBoxHandler);
  mBridgeIdleDebugListener = bridgeIdleDebugListener;
  mLifecycleState = initialLifecycleState;
  mUIImplementationProvider = uiImplementationProvider;
  mMemoryPressureRouter = new MemoryPressureRouter(applicationContext);
  mNativeModuleCallExceptionHandler = nativeModuleCallExceptionHandler;
  mJSCConfig = jscConfig;
  mLazyNativeModulesEnabled = lazyNativeModulesEnabled;
  mLazyViewManagersEnabled = lazyViewManagersEnabled;
  mUseStartupThread = useStartupThread;
}
项目:RNLearn_Project1    文件:ReactInstanceManagerBuilder.java   
/**
 * Set the exception handler for all native module calls. If not set, the default
 * {@link DevSupportManager} will be used, which shows a redbox in dev mode and rethrows
 * (crashes the app) in prod mode.
 */
public ReactInstanceManagerBuilder setNativeModuleCallExceptionHandler(
  NativeModuleCallExceptionHandler handler) {
  mNativeModuleCallExceptionHandler = handler;
  return this;
}
项目:RNLearn_Project1    文件:CatalystInstanceImpl.java   
public Builder setNativeModuleCallExceptionHandler(
    NativeModuleCallExceptionHandler handler) {
  mNativeModuleCallExceptionHandler = handler;
  return this;
}
项目:RNLearn_Project1    文件:ReactInstanceManager.java   
ReactInstanceManager(
  Context applicationContext,
  @Nullable Activity currentActivity,
  @Nullable DefaultHardwareBackBtnHandler defaultHardwareBackBtnHandler,
  @Nullable JSBundleLoader bundleLoader,
  @Nullable String jsMainModuleName,
  List<ReactPackage> packages,
  boolean useDeveloperSupport,
  @Nullable NotThreadSafeBridgeIdleDebugListener bridgeIdleDebugListener,
  LifecycleState initialLifecycleState,
  UIImplementationProvider uiImplementationProvider,
  NativeModuleCallExceptionHandler nativeModuleCallExceptionHandler,
  JSCConfig jscConfig,
  @Nullable RedBoxHandler redBoxHandler,
  boolean lazyNativeModulesEnabled,
  boolean lazyViewManagersEnabled,
  boolean useStartupThread) {

  initializeSoLoaderIfNecessary(applicationContext);

  // TODO(9577825): remove this
  ApplicationHolder.setApplication((Application) applicationContext.getApplicationContext());
  DisplayMetricsHolder.initDisplayMetricsIfNotInitialized(applicationContext);

  mApplicationContext = applicationContext;
  mCurrentActivity = currentActivity;
  mDefaultBackButtonImpl = defaultHardwareBackBtnHandler;
  mBundleLoader = bundleLoader;
  mJSMainModuleName = jsMainModuleName;
  mPackages = packages;
  mUseDeveloperSupport = useDeveloperSupport;
  mDevSupportManager = DevSupportManagerFactory.create(
      applicationContext,
      mDevInterface,
      mJSMainModuleName,
      useDeveloperSupport,
      redBoxHandler);
  mBridgeIdleDebugListener = bridgeIdleDebugListener;
  mLifecycleState = initialLifecycleState;
  mUIImplementationProvider = uiImplementationProvider;
  mMemoryPressureRouter = new MemoryPressureRouter(applicationContext);
  mNativeModuleCallExceptionHandler = nativeModuleCallExceptionHandler;
  mJSCConfig = jscConfig;
  mLazyNativeModulesEnabled = lazyNativeModulesEnabled;
  mLazyViewManagersEnabled = lazyViewManagersEnabled;
  mUseStartupThread = useStartupThread;
}
项目:RNLearn_Project1    文件:ReactInstanceManagerBuilder.java   
/**
 * Set the exception handler for all native module calls. If not set, the default
 * {@link DevSupportManager} will be used, which shows a redbox in dev mode and rethrows
 * (crashes the app) in prod mode.
 */
public ReactInstanceManagerBuilder setNativeModuleCallExceptionHandler(
  NativeModuleCallExceptionHandler handler) {
  mNativeModuleCallExceptionHandler = handler;
  return this;
}
项目:RNLearn_Project1    文件:CatalystInstanceImpl.java   
public Builder setNativeModuleCallExceptionHandler(
    NativeModuleCallExceptionHandler handler) {
  mNativeModuleCallExceptionHandler = handler;
  return this;
}
项目:Ironman    文件:XReactInstanceManagerImpl.java   
XReactInstanceManagerImpl(
  Context applicationContext,
  @Nullable Activity currentActivity,
  @Nullable DefaultHardwareBackBtnHandler defaultHardwareBackBtnHandler,
  @Nullable JSBundleLoader bundleLoader,
  @Nullable String jsMainModuleName,
  List<ReactPackage> packages,
  boolean useDeveloperSupport,
  @Nullable NotThreadSafeBridgeIdleDebugListener bridgeIdleDebugListener,
  LifecycleState initialLifecycleState,
  UIImplementationProvider uiImplementationProvider,
  NativeModuleCallExceptionHandler nativeModuleCallExceptionHandler,
  JSCConfig jscConfig,
  @Nullable RedBoxHandler redBoxHandler,
  boolean lazyNativeModulesEnabled,
  boolean lazyViewManagersEnabled) {

  initializeSoLoaderIfNecessary(applicationContext);

  // TODO(9577825): remove this
  ApplicationHolder.setApplication((Application) applicationContext.getApplicationContext());
  DisplayMetricsHolder.initDisplayMetricsIfNotInitialized(applicationContext);

  mApplicationContext = applicationContext;
  mCurrentActivity = currentActivity;
  mDefaultBackButtonImpl = defaultHardwareBackBtnHandler;
  mBundleLoader = bundleLoader;
  mJSMainModuleName = jsMainModuleName;
  mPackages = packages;
  mUseDeveloperSupport = useDeveloperSupport;
  mDevSupportManager = DevSupportManagerFactory.create(
      applicationContext,
      mDevInterface,
      mJSMainModuleName,
      useDeveloperSupport,
      redBoxHandler);
  mBridgeIdleDebugListener = bridgeIdleDebugListener;
  mLifecycleState = initialLifecycleState;
  mUIImplementationProvider = uiImplementationProvider;
  mMemoryPressureRouter = new MemoryPressureRouter(applicationContext);
  mNativeModuleCallExceptionHandler = nativeModuleCallExceptionHandler;
  mJSCConfig = jscConfig;
  mLazyNativeModulesEnabled = lazyNativeModulesEnabled;
  mLazyViewManagersEnabled = lazyViewManagersEnabled;
}
项目:Ironman    文件:CatalystInstanceImpl.java   
public Builder setNativeModuleCallExceptionHandler(
    NativeModuleCallExceptionHandler handler) {
  mNativeModuleCallExceptionHandler = handler;
  return this;
}
项目:ReactNativeSignatureExample    文件:ReactInstanceManager.java   
/**
 * Set the exception handler for all native module calls. If not set, the default
 * {@link DevSupportManager} will be used, which shows a redbox in dev mode and rethrows
 * (crashes the app) in prod mode.
 */
public Builder setNativeModuleCallExceptionHandler(NativeModuleCallExceptionHandler handler) {
  mNativeModuleCallExceptionHandler = handler;
  return this;
}
项目:react-native-ibeacon-android    文件:ReactInstanceManager.java   
/**
 * Set the exception handler for all native module calls. If not set, the default
 * {@link DevSupportManager} will be used, which shows a redbox in dev mode and rethrows
 * (crashes the app) in prod mode.
 */
public Builder setNativeModuleCallExceptionHandler(NativeModuleCallExceptionHandler handler) {
  mNativeModuleCallExceptionHandler = handler;
  return this;
}
项目:react-native-box-loaders    文件:ReactInstanceManager.java   
/**
 * Set the exception handler for all native module calls. If not set, the default
 * {@link DevSupportManager} will be used, which shows a redbox in dev mode and rethrows
 * (crashes the app) in prod mode.
 */
public Builder setNativeModuleCallExceptionHandler(NativeModuleCallExceptionHandler handler) {
  mNativeModuleCallExceptionHandler = handler;
  return this;
}
项目:Ironman    文件:ReactInstanceManager.java   
/**
 * Set the exception handler for all native module calls. If not set, the default
 * {@link DevSupportManager} will be used, which shows a redbox in dev mode and rethrows
 * (crashes the app) in prod mode.
 */
public Builder setNativeModuleCallExceptionHandler(NativeModuleCallExceptionHandler handler) {
  mNativeModuleCallExceptionHandler = handler;
  return this;
}