There used to be a section of Android docs that mentions using RCTDeviceEventEmitter to pass events between Native and JS. However, since RCTDeviceEventEmitter was deprecated in favor of subclassing NativeEventEmitter, this section of docs, instead of being updated with how to use NativeEventEmitter, just got completely deleted in this commit https://github.com/hramos/react-native/commit/b11f8f4936459c104b4fccb3da5eef1d53aa76f7.
Now the docs are strange, there's this mention that events will be described below, but they never are. We need some Android example docs for NativeEventEmitter.
I'd be happy to write this if needed.
I tried subclassing NativeEventEmitter but it requires registering a JS Module which also seems not possible right now. I documented this related but distinct issue in https://github.com/facebook/react-native/issues/14062.
However, using NativeAppEventEmitter seems to be the only way to emit events right now. Even though there is a comment that it is deprecated, maybe the developer in https://github.com/facebook/react-native/commit/516bf7bd94d14600920a3d78fdcf51ea7fe48495 @nicklockwood meant to deprecate it only internally, and not externally?
In either case, some Android documentation on how to emit events, as callbacks definitely do not satisfy Native-JS communication enough!
Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally!
If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:
If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.
Most helpful comment
I tried subclassing NativeEventEmitter but it requires registering a JS Module which also seems not possible right now. I documented this related but distinct issue in https://github.com/facebook/react-native/issues/14062.
However, using NativeAppEventEmitter seems to be the only way to emit events right now. Even though there is a comment that it is deprecated, maybe the developer in https://github.com/facebook/react-native/commit/516bf7bd94d14600920a3d78fdcf51ea7fe48495 @nicklockwood meant to deprecate it only internally, and not externally?
In either case, some Android documentation on how to emit events, as callbacks definitely do not satisfy Native-JS communication enough!