The expo-direct-call
is a React Native Expo library that simplifies the process of placing calls on both Android and iOS platforms. On Android, it allows you to place a direct call without any user prompt by asking for permissions and using the system dialer. On iOS, it shows the user a system prompt to confirm the call.
The library exposes a single directCall
method, which returns a Promise that resolves when the call action is completed.
This package is not published on npm yet, so you'll need to install it directly from GitHub:
npm install https://github.com/aguglie/expo-direct-call
First, import the package in your React Native project.
import * as ExpoDirectCall from 'expo-direct-call';
Then, you can use the directCall
method to initiate a call:
<Button
onPress={() => ExpoDirectCall.directCall("123456789", {
title: "Place call permission",
message: "We need your permission to place direct calls"
})}
title="Call 123456789"
/>
Parameter | Type | Description |
---|---|---|
phoneNumber |
string |
The phone number to call. |
prompt |
AndroidPermissionPrompt |
An object with the title and message for the Android permission prompt. |
The library includes an example folder with a sample app to demonstrate the usage of expo-direct-call
.
MIT License