I want to make a phone call in React Native, I am a beginner on react native so I came across this question which looks like mine => How to make phone call in React Native?
So, this is a part of my code but it's not working, when I click on the icon, nothing is happening and I have no error on my terminal, it's very weird. This is my code:
import React from 'react';
import { Image, Text, View, StyleSheet } from 'react-native';
import { Avatar } from "react-native-elements";
import { Linking } from 'react-native';
export const makeCall = () => {
let phoneNumber = '';
if (Platform.OS === 'android') {
phoneNumber = 'tel:${0123456789}';
} else {
phoneNumber = 'telprompt:${0123456789}';
}
Linking.openURL(phoneNumber);
};
const Contacts = () => {
return (
<View style={styles.column}>
<Avatar
size={65}
rounded
overlayContainerStyle={{ backgroundColor: '#fff' }}
icon={{ name: 'phone', color: '#113D78', type: 'font-awesome' }}
onPress={() => makeCall}
style={{
width: 65,
height: 65,
borderRadius: 50,
borderWidth: 2,
borderColor: '#113D78',
}}
/>
<Text style={styles.subtitle}>Phone</Text>
</View>
);
}
export default Contacts;