when i navigate to main calling screen after accepting call i get following error.
TypeError: undefined is not an object (evaluating ‘C.getCallEventListener’)
“@cometchat-pro/react-native-calls”: “^1.0.0”,
“@cometchat-pro/react-native-chat”: “^2.1.2”,
i am using this one .
Hello @rahul_webnexus2020,
Can you please share the code snippet so that we can check it on our end.
Warm Regards
Mayur Bhandari
CometChat Pro
import React, {Component} from ‘react’;
import {View} from ‘react-native’;
import {CometChat} from ‘@cometchat-pro/react-native-chat’;
class Index extends Component {
constructor(props) {
super(props);
try {
let self = this;
let callListener = new CometChat.OngoingCallListener({
onUserJoined: (user) => {
console.log(
‘TEST => OngoingCallListener: User joined call:’,
user.getUid(),
);
},
onUserLeft: (user) => {
console.log(
‘TEST => OngoingCallListener: User left call:’,
user.getUid(),
new Date().getTime(),
);
self.gotoChat();
},
onCallEnded: (call) => {
console.log(
‘TEST => OngoingCallListener: Call ended listener’,
call.getSessionId(),
call.status,
);
self.gotoChat();
},
});
this.addCallListner();
this.sessionId = this.getParams(‘sessionId’, ‘sessionid’);
this.defaultLayout = this.getParams(‘enableDefaultLayout’, 1);
this.entity = this.getParams(‘entity’, {});
this.entityType = this.getParams(‘entityType’, ‘default’);
this.acceptedFrom = this.getParams(‘acceptedFrom’, ‘’);
this.audioOnly = this.getParams(‘isAudioOnly’, 0);
this.callSettings = new CometChat.CallSettingsBuilder()
.setSessionID(this.sessionId)
.enableDefaultLayout(true)
.setIsAudioOnly(this.audioOnly)
.setCallEventListener(callListener)
.build();
} catch (e) {
console.log(e, ‘error’);
}
}
getParams = (type, defaultvalue) => {
let {params = {}} = this.props.route ?? {};
let _data = params ?? {};
return _data[type] ?? defaultvalue;
};
addCallListner = () => {
let self = this;
var listnerID = ‘MAIN_CALLING_SCREEN_CALL_LISTENER’;
try {
CometChat.addCallListener(
listnerID,
new CometChat.CallListener({
onIncomingCallReceived(call) {
var sessionID = call.getSessionId();
var status = CometChat.CALL_STATUS.BUSY;
CometChat.rejectCall(sessionID, status).then(
(rejectedCall) => {
console.log(‘Incoming Call rejected’, rejectedCall);
self.gotoChat();
},
(error) => {
console.log(‘Call rejection failed with error:’, error);
},
);
},
}),
);
} catch (e) {
console.log(e, ‘error’);
}
};
componentWillUnmount() {
CometChat.removeCallListener(‘MAIN_CALLING_SCREEN_CALL_LISTENER’);
}
gotoChat = () => {
this.props.navigation.goBack();
};
render() {
try {
return (
<View style={{height: ‘100%’, width: ‘100%’, position: ‘relative’}}>
<CometChat.CallingComponent callsettings={this.callSettings} />
);
} catch (e) {
console.log(e, ‘error’);
}
}
}
export default Index;
Hello @rahul_webnexus2020,
Can you please let us know what is the iOS version of the simulator you are using to test?
Warm Regards,
Mayur Bhandari
CometChat Pro
This is an issue with react native and iOS 14. You can run in on a real iPhone running iOS 14 and your icons should appear, also you can just run in a simulator running 13.4 or 13.5 and it should work as well.
I tested it is working fine . but call listener and message listener sometime working, sometime not.
Hello @rahul_webnexus2020,
You can receive real-time events only if you are connected to our WS servers. You can use Connection Listeners to get real-time updates about the connection status to our WS servers. You can also get your current connection status. You can find more detail about Connection Listeners here .
Warm Regards,
Mayur Bhandari
CometChat Pro
I hope the information shared by Mayur was helpful. I am closing out this ticket due to inactivity. Please feel free to write to us at help@cometchat.com if you require any further assistance.
Regards,
Rahul
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.