javascript – new NativeEventEmitter() requires a non-null argument

0
21
javascript – new NativeEventEmitter() requires a non-null argument


I’m encountering an error when making an attempt to register the foreground service utilizing ReactNativeForegroundService from the @supersami/rn-foreground-service library. The identical code works accurately on Android, however I’m dealing with points on iOS.

Code:

import ReactNativeForegroundService from "@supersami/rn-foreground-service";

const config = {
  config: {
    alert: true,
    onServiceErrorCallBack: perform () {
      console.warn('[ReactNativeForegroundService] onServiceErrorCallBack', arguments);
    },
  }
};

ReactNativeForegroundService.register(config);

Error:

ERROR  Invariant Violation: `new NativeEventEmitter()` requires a non-null argument., js engine: hermes
WARN  Module ReactNativeEventEmitter requires foremost queue setup because it overrides `init` however does not implement `requiresMainQueueSetup`. In a future launch React Native will default to initializing all native modules on a background thread except explicitly opted-out of.
LOG  Operating "Cerge" with {"rootTag":21,"initialProps":{}}

Atmosphere:

Steps to Reproduce:

  1. Set up the @supersami/rn-foreground-service library.

  2. Use the ReactNativeForegroundService.register(config) technique within the code as proven above.

  3. Run the app on iOS with Hermes enabled.

Anticipated Conduct: The service ought to register with out errors.

Precise Conduct: The error new NativeEventEmitter() requires a non-null argument happens, and the warning about requiresMainQueueSetup seems.

Extra Context: This problem seems to be associated to how the NativeEventEmitter is being initialized with a null or undefined argument. The warning suggests the module could have to implement requiresMainQueueSetup.

I attempted putting in the most recent model of the @supersami/rn-foreground-service library and registering the service utilizing each the configuration technique and the simplified strategy like this:

ReactNativeForegroundService.register({id: 144});

Nonetheless, nothing labored, and I nonetheless obtained the identical error.

LEAVE A REPLY

Please enter your comment!
Please enter your name here