Change extension phone number

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

Tried a few options

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

Dialer only dials the primary number and does not include the extension

I could write my own code and set the method, but this will be my last option

+7
android react-native-android
source share
2 answers

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

It works great on both iOS and Android.

You need to import it into the necessary file:

 import Communications from 'react-native-communications'; 

and then use it as you need:

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

This is what I tried

 callNumber = (url) =>{ Linking.canOpenURL(url).then(supported => { if (!supported) { console.log('Can\'t handle url: ' + url); } else { return Linking.openURL(url); } }).catch(err => console.error('An error occurred', err)); } 

And JSX,

 <Text onPress={()=> this.callNumber(`tel:+91${user.number}`)} style = {[styles.value,{marginLeft : 5,textDecorationLine :'underline'}]}>{`+91 ${user.number}`}</Text> </View> 

Works great for me. You can find more at the link here, https://facebook.imtqy.com/react-native/docs/linking.html

+3
source share

All Articles