react-native-webrtc / react-native-webrtc/react-native-callkeep
Event Listeners are not called on JS side, even when Events are emitted from Native Emitter on iOS.
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 511
- Avg merge
- 9h 12m
- Merged PRs (30d)
- 2
Description
Bug report
-
I've checked the example to reproduce the issue.
https://github.com/react-native-webrtc/react-native-callkeep/issues/432 -
Reproduced on:
-
Android
-
iOS
Description
We are building a calling feature for iOS App.
I was not getting any events from CallKeep, not even DidDisplayIncomingCall.
I tried creating a fresh app from scratch and tried installing CallKeep in it. It works perfectly fine.
However, it is still not working with our setup. I debugged the Native side using Xcode and found out that the Native side is perfectly fine and sending events.
Step 1
So I used the following snippet in App.js (before component declaration) to see if the event is getting through.
import {NativeEventEmitter, NativeModules} from 'react-native';
const eventEmitter = new NativeEventEmitter(NativeModules.RNCallKeep);
const customListener = eventEmitter.addListener(
'RNCallKeepDidDisplayIncomingCall',
data => {
console.log('RNCallKeepDidDisplayIncomingCall2', data);
},
);
console.log('P: index.js:26 : customListener', customListener);
After this, when calling RNCallKeep.displayIncomingCall, this got logged from the listener I added above.
RNCallKeepDidDisplayIncomingCall2 {"callUUID": "3a1ca95e-2d29-451b-8297-f7d6a74bb0d7", "error": "", "fromPushKit": "0", "handle": "@pankajvaghela", "hasVideo": "0", "localizedCallerName": "pankaj", "payload": "", "supportsDTMF": "1", "supportsGrouping": "1", "supportsHolding": "1", "supportsUngrouping": "1"}
However, the callback in RNCallKeep.addEventListener('didReceiveStartCallAction', callback) never gets called.
Step 2
Then I checked the didDisplayIncomingCall function in actions.js and see if callback in there ever gets called, it never does.
I logged out listener objects returned from addListener returned by eventEmitter.addListener outside of the library(inside App.js) and inside the library (action.js file of CallKeep). They are similar for the most part except for some keys at the end.
Listener object when added From App :
{"context": undefined, "emitter": {"_disableCallsIntoModule": false, "_nativeModule": {"_startCallActionEventListenerAdded": [Function nonPromiseMethodWrapper], "addListener": [Function nonPromiseMethodWrapper], "answerIncomingCall": [Function nonPromiseMethodWrapper], "checkIfBusy": [Function promiseMethodWrapper], "checkSpeaker": [Function promiseMethodWrapper], "displayIncomingCall": [Function nonPromiseMethodWrapper], "endAllCalls": [Function nonPromiseMethodWrapper], "endCall": [Function nonPromiseMethodWrapper], "getAudioRoutes": [Function promiseMethodWrapper], "getCalls": [Function promiseMethodWrapper], "getConstants": [Function anonymous], "getInitialEvents": [Function promiseMethodWrapper], "isCallActive": [Function promiseMethodWrapper], "removeListeners": [Function nonPromiseMethodWrapper], "reportConnectedOutgoingCallWithUUID": [Function nonPromiseMethodWrapper], "reportConnectingOutgoingCallWithUUID": [Function nonPromiseMethodWrapper], "reportEndCallWithUUID": [Function nonPromiseMethodWrapper], "reportUpdatedCall": [Function nonPromiseMethodWrapper], "sendDTMF": [Function nonPromiseMethodWrapper], "setAudioRoute": [Function promiseMethodWrapper], "setMutedCall": [Function nonPromiseMethodWrapper], "setOnHold": [Function nonPromiseMethodWrapper], "setup": [Function nonPromiseMethodWrapper], "startCall": [Function nonPromiseMethodWrapper], "updateDisplay": [Function nonPromiseMethodWrapper]}, "_subscriber": {"_currentSubscription": null, "_subscriptionsForType": [Object]}}, "eventType": "RNCallKeepDidDisplayIncomingCall", "key": 0, "listener": [Function anonymous], "subscriber": {"_currentSubscription": null, "_subscriptionsForType": {"RCTDevMenuShown": [Array], "RNCallKeepDidDisplayIncomingCall": [Array], "appStateDidChange": [Array], "appearanceChanged": [Array], "collectBugExtraData": [Array], "collectRedBoxExtraData": [Array], "didUpdateDimensions": [Array], "keyboardWillChangeFrame": [Array], "rnfb_auth_id_token_changed": [Array], "rnfb_auth_state_changed": [Array], "rnfb_dynamic_links_link_received": [Array], "rnfb_firestore_collection_sync_event": [Array], "rnfb_firestore_document_sync_event": [Array], "rnfb_firestore_transaction_event": [Array], "rnfb_messaging_message_deleted": [Array], "rnfb_messaging_message_received": [Array], "rnfb_messaging_message_received_background": [Array], "rnfb_messaging_message_send_error": [Array], "rnfb_messaging_message_sent": [Array], "rnfb_messaging_notification_opened": [Array], "rnfb_messaging_token_refresh": [Array], "rnfb_phone_auth_state_changed": [Array], "toggleElementInspector": [Array], "url": [Array], "websocketClosed": [Array], "websocketFailed": [Array], "websocketMessage": [Array], "websocketOpen": [Array]}}}
Listener object when added From Library :
{"context": undefined, "emitter": {"_disableCallsIntoModule": false, "_nativeModule": {"_startCallActionEventListenerAdded": [Function nonPromiseMethodWrapper], "addListener": [Function nonPromiseMethodWrapper], "answerIncomingCall": [Function nonPromiseMethodWrapper], "checkIfBusy": [Function promiseMethodWrapper], "checkSpeaker": [Function promiseMethodWrapper], "displayIncomingCall": [Function nonPromiseMethodWrapper], "endAllCalls": [Function nonPromiseMethodWrapper], "endCall": [Function nonPromiseMethodWrapper], "getAudioRoutes": [Function promiseMethodWrapper], "getCalls": [Function promiseMethodWrapper], "getConstants": [Function anonymous], "getInitialEvents": [Function promiseMethodWrapper], "isCallActive": [Function promiseMethodWrapper], "removeListeners": [Function nonPromiseMethodWrapper], "reportConnectedOutgoingCallWithUUID": [Function nonPromiseMethodWrapper], "reportConnectingOutgoingCallWithUUID": [Function nonPromiseMethodWrapper], "reportEndCallWithUUID": [Function nonPromiseMethodWrapper], "reportUpdatedCall": [Function nonPromiseMethodWrapper], "sendDTMF": [Function nonPromiseMethodWrapper], "setAudioRoute": [Function promiseMethodWrapper], "setMutedCall": [Function nonPromiseMethodWrapper], "setOnHold": [Function nonPromiseMethodWrapper], "setup": [Function nonPromiseMethodWrapper], "startCall": [Function nonPromiseMethodWrapper], "updateDisplay": [Function nonPromiseMethodWrapper]}, "_subscriber": {"_currentSubscription": null, "_subscriptionsForType": [Object]}}, "eventType": "RNCallKeepDidDisplayIncomingCall", "key": 0, "listener": [Function anonymous], "subscriber": {"_currentSubscription": null, "_subscriptionsForType": {"RNCallKeepDidDisplayIncomingCall": [Array], "RNCallKeepDidPerformDTMFAction": [Array], "RNCallKeepDidPerformSetMutedCallAction": [Array], "RNCallKeepDidReceiveStartCallAction": [Array], "RNCallKeepPerformAnswerCallAction": [Array], "RNCallKeepPerformEndCallAction": [Array], "didUpdateDimensions": [Array]}}}
Notes:
- RNCallKeep.setup() was called before addEventListener
Following issues might be related to this.
- https://github.com/react-native-webrtc/react-native-callkeep/issues/509
- https://github.com/react-native-webrtc/react-native-callkeep/issues/511
- https://github.com/react-native-webrtc/react-native-callkeep/issues/432
- https://github.com/react-native-webrtc/react-native-callkeep/issues/330
- https://github.com/react-native-webrtc/react-native-callkeep/issues/406
Steps to Reproduce
Tried Reproducing this one new project, but it's working fine in a new project.
Versions
- Callkeep: 4.3.1
- React Native: 0.64.2
- iOS: 12.5.1
- Android:
- Phone model: iPhone 7
Logs
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with App.js and the library's actions.js, comparing the NativeEventEmitter listener registrations shown in the report. Reproduce the iOS behavior with the reported CallKeep, React Native, and iOS versions, then trace why the native event reaches a direct listener but not RNCallKeep.addEventListener. Done means the reported CallKeep callback receives the native event in the affected setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, javascript
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100