React native -- call phone number with extension

Sudhu picture Sudhu · Jun 28, 2016 · Viewed 22.6k times · Source

I am trying to open phone number with extension. Linking works with just phone number

Tried with few options

Linking.openURL('tel:XXXXXXXXX,XXX');

Linking.openURL('tel:'+ encodeURIComponent('XXXXXXXXX,XXX'));

Dialer only dials primary number and doesnt include extension

I could write a native code and expose the method, but that would be my last option

Answer

Mark picture Mark · Oct 9, 2016

I know it is late, but you can try this component: react-native-communications.

It works well both on iOS and Android.

You have to import it in the file you need:

import Communications from 'react-native-communications';

and then use it as you need:

<TouchableOpacity onPress={() => Communications.phonecall(phoneNumbers[0].number, true)}>