Quantcast
Channel: How to make phone call in React Native? - Stack Overflow
Viewing all articles
Browse latest Browse all 14

Answer by Codemaker for How to make phone call in React Native?

$
0
0

1. install react-native-phone-call package using npm

$ npm install --save react-native-phone-call

2. create a method called makeCall()

makeCall = (number) => {     const args = {         number: number, // String value with the number to call         prompt: true // Optional boolean property. Determines if the user should be prompt prior to the call      }    call(args).catch(console.error)}

3. call the method in onPress event of a TouchableOpacity

<TouchableOpacity key={index} style={{width: '80%', height: 80, backgroundColor: 'rgb(186, 186, 186)',  alignItems:'center', justifyContent: 'space-between', borderBottomWidth: 0.5, borderBottomColor: '#000000'}}             onPress={()=> this.makeCall(item.contactNumber)}>

Viewing all articles
Browse latest Browse all 14

Trending Articles