Error when picking up call

Im trying to make a call from my react js app which use the javascript sdk v2.1.0 to my react native app which use react native sdk v2.1.0-beta6. but i keep getting this error when trying to render the Cometchat.callingcomponent once the other use pick up call, or when i made the call and the other user pick up.

TypeError: undefined is not an object. (ealuating T.CometChat.appSettings.getRegion)

Here’s the snippet of code where i try to render the callscreen

import { CometChat } from '@cometchat-pro/react-native-chat'
import { useSelector, useDispatch } from 'react-redux'
import React from 'react'
import { View, Platform, PermissionsAndroid } from 'react-native'

export default props => {
  const { activeCall } = props.navigation.state.params || {}
  const [permission, setPermission] = React.useState(false)
  let settings = new CometChat
    .setCallEventListener(new CometChat.OngoingCallListener({
      onUserJoined: user => {
        console.tron.log('OngoingCallListener: User joined call:', user)
      onUserLeft: user => {
        console.tron.log('OngoingCallListener: User left call:', user)
      onCallEnded: call => {
        console.tron.log('OngoingCallListener: Call ended listener', call)

  React.useEffect(() => {
    async function getPermission() {
      const rationale = {
        title: 'Permission Required',
        message: 'Allow permission for better experience',
        buttonPositive: 'Allow',
        buttonNegative: 'Reject'

      if(Platform.OS === 'android') {
        await PermissionsAndroid.requestMultiple([
        ]).then(res => {
          // console.log('===========gettting permission', res, PermissionsAndroid.RESULTS.GRANTED, Object.values(res).every(permission => permission === PermissionsAndroid.RESULTS.GRANTED))
          if(Object.values(res).every(permission => permission === PermissionsAndroid.RESULTS.GRANTED))
          // console.log('==========got permission', [audioPermission, camPermission])
          // if(audioPermission === PermissionsAndroid.RESULTS.GRANTED && camPermission === PermissionsAndroid.RESULTS.GRANTED)
          //   this.permissionsGranted = true
        }).catch(error => console.log('error getting permissions', error))
  }, [])
  return (
    <View style={{height: '100%', width: '100%', position: 'relative'}}>
        Platform.OS === 'android'
        ? permission && <CometChat.CallingComponent callsettings={settings} onFailure = {(e)=>{console.log('error', e);}} />
        : <CometChat.CallingComponent callsettings= {settings} onFailure = {(e)=>{console.log('error', e);}} />

Hello @mike_van, We have stable ReactNative SDK v2.1.0. We recommend upgrading to the latest version.

Upgrading to the latest version should solve the issue you are facing.

Thank You

Hi thanks for the reply. I upgraded now and i get this error.

TypeError: I.CallController.getInstance().getCallListner()._eventListener.onError is not a function. (In 'I.CallController.getInstance().getCallListner()._eventListener.onError(new R.CometChatException(A.CALL_ERROR.NOT_INITIALIZED))', 'I.CallController.getInstance().getCallListner()._eventListener.onError' is undefined) This error is located at: in NavigationContainer (at Root.js:59) in Unknown (at App.js:79) in PersistGate (at App.js:78) in Provider (at App.js:77) in Root in RCTView (at AppContainer.js:101) in RCTView (at AppContainer.js:119) in AppContainer (at renderApplication.js:39)

appear to be some sort android permission error? cos i think i enabled the voice_audio and camera here. or is there anything else im missing?

Hello @mike_van,

Please add the onError callback in the setCallEventListener(). You can check the documentation here.
Also, it looks like CometChat is not initialized when you are trying to start a call. You can refer to our sample app here.

Warm Regards,

CometChat Pro
Mayur Bhandari

1 Like

Hi @mike_van,

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 if you require any further assistance.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.