Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twilio call is not working in iOS and Android in react-native

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

like image 893
Sport Avatar asked Sep 27 '16 05:09

Sport


People also ask

Does react native code work on iOS and Android?

React Native combines the best parts of native development with React, a best-in-class JavaScript library for building user interfaces. Use a little—or a lot. You can use React Native today in your existing Android and iOS projects or you can create a whole new app from scratch.

Does twilio work with react native?

Note* : Make sure to do react-native link react-native-vector-icons after downloading packages. Now before we start coding, we need to do little setup in-order to Twilio to work in our app. Go to iOS > Podfile and change following: Add following permission dependencies in same Podfile.

Can the same react components be used for both Android and iOS?

With React Native, one team can maintain two platforms and share a common technology — React. As you can use the same source code to run on iOS and Android devices, you don't have to hire separate developers to write code for Android and iOS devices.


1 Answers

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);
like image 152
Sport Avatar answered Oct 25 '22 03:10

Sport