9

i am trying to use twilio client in react native app. here is the link Twilio repo after done all setup with react native twilio .when i am calling a number getting issue . i used all steps give in this link . enter image description here

[tid:com.facebook.react.JavaScript] handler is not a function. (In 'handler(rtn)', 'handler' is undefined) 2016-09-27 11:00:57.857 [fatal]

[tid:com.facebook.react.RCTExceptionsManagerQueue] Unhandled JS Exception: handler is not a function. (In 'handler(rtn)', 'handler' is undefined). code is breaking in twilio app in index.js

addEventListener(type, handler) {
_eventHandlers[type].set(handler, NativeAppEventEmitter.addListener(
type, rtn => {
handler(rtn);
}
));
},

not able to get where is the issue . i tried to implement in my native base code its working fine so my server setup does not have any issue .but don't how to solve in react native . any one have any idea about the issue. enter image description here

Megan Speir
  • 3,745
  • 1
  • 15
  • 25
Sport
  • 8,570
  • 6
  • 46
  • 65
  • How do you call `Twilio.addEventListener`? You need to pass a function for the second argument. – Kerumen Sep 27 '16 at 08:22
  • I am not calling like this Twilio.addEventListener('deviceDidStartListening', this.deviceDidStartListening()); – Sport Sep 27 '16 at 09:03
  • 2
    _Not_? If it's a typo and you are calling like this, it's wrong. You have to do `Twilio.addEventListener('deviceDidStartListening', this.deviceDidStartListening);` You must not call the function but only pass the reference. – Kerumen Sep 27 '16 at 09:12

1 Answers1

5

I have fixed that issue .issue is not in twilio npm . issue about the setup iOS react native project. now i have used this steps 1-in node_modules,react-native-twilio/ios and add RCTTwilio.xcodeproj to your project.

2- Add libRCTTwilio.a to Build Phases -> Link Binary With Libraries

I have done mistake to call Twilio.addEventListener (), its need Twilio.addEventListener ('type of event', 'call a event hadler'),

for example

Twilio.addEventListener('deviceDidReceiveIncoming', this._deviceDidReceiveIncoming);
Sport
  • 8,570
  • 6
  • 46
  • 65