How to make a phone call directly from the app using react native?

321 views Asked by At

I tried react-native-phone-call and also tried with Linking in react native but these two methods, first open dialer screen with number provided and then we have to manually press on call icon on dialer screen.

I want call should directly initiate from my project app. It should not open dialer app and then call.

I want to build something like this but in react native : https://www.youtube.com/watch?v=UDwj5j4tBYg&t=19s

1

There are 1 answers

2
Pramod On

You can use Linking to open the phone number in dialled content.

Working example: https://snack.expo.dev/@msbot01/spunky-yellow-waffle

import { Text, SafeAreaView, StyleSheet, Button, Linking } from 'react-native';

export default function App() {
  return (
    <SafeAreaView style={styles.container}>
      
      <Button
        onPress={() => {Linking.openURL('tel:987323131');}}
        title="Call Helpline"
      />
      
    </SafeAreaView>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    backgroundColor: '#ecf0f1',
    padding: 8,
  }
});