I’m encountering an error when attempting to register the foreground service utilizing ReactNativeForegroundService from the @supersami/rn-foreground-service library. The identical code works accurately on Android, however I’m going through points on iOS.
Code:
import ReactNativeForegroundService from "@supersami/rn-foreground-service";
const config = {
config: {
alert: true,
onServiceErrorCallBack: operate () {
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 most important queue setup because it overrides `init` however would 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":{}}
Setting:
Steps to Reproduce:
-
Set up the
@supersami/rn-foreground-servicelibrary. -
Use the
ReactNativeForegroundService.register(config)technique within the code as proven above. -
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.
Further Context: This situation seems to be associated to how the NativeEventEmitter is being initialized with a null or undefined argument. The warning suggests the module could must implement requiresMainQueueSetup.
I attempted putting in the newest 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.

