Giter Site home page Giter Site logo

react-native-phone-call's Introduction

react-native-phone-call

package version package downloads standard-readme compliant package license make a pull request

Initiate a phone call in React Native.

Table of Contents

Background

This is a small wrapper that allows you to initiate a phone call in React Native.

Running on iOS simulator

When running on the iOS simulator, you will get a the URL is invalid error. This will work on an actual device. The iOS simulator does not have access to the dialer app..

Running on Android SDK 30+

Android SDK 30 introduced changes around how apps can query and interact with other apps. This means Linking.canOpenURL returns false for all links unless a <queries> element is added to AndroidManifest.xml. Adding the following intent to android/app/src/main/AndroidManifest.xml should resolve the issue:

<queries>
      <intent>
        <action android:name="android.intent.action.DIAL" />
      </intent>
</queries>

Limitations

This module only provides a simple wrapper around the Linking API and is thus limited in the functionality it can provide. If you are looking for additional functionality, such as being able to initiate a phone call without user confirmation, please use other packages like react-native-immediate-phone-call.

Install

Install the package locally within you project folder with your package manager:

With npm:

npm install react-native-phone-call

With yarn:

yarn add react-native-phone-call

Usage

To use the module, call the function with an object containing the number to call as a argument.

import call from 'react-native-phone-call'

const args = {
  number: '9093900003', // String value with the number to call
  prompt: false, // Optional boolean property. Determines if the user should be prompted prior to the call 
  skipCanOpen: true // Skip the canOpenURL check
}

call(args).catch(console.error)

Example with phone and extension.

Use commas to add time between pressing different digits. (ex. dial a number and wait to be connected and menu to start being read. Press a number for an extension. Even wait longer for another menus and press another number for another extension.)

const args = {
  number: '9093900003,,,3,,,274', // Use commas to add time between digits.
  prompt: false
}

call(args).catch(console.error)

API

For all configuration options, please see the API docs.

Contributing

Got an idea for a new feature? Found a bug? Contributions are welcome! Please open up an issue or make a pull request.

License

MIT © Tiaan du Plessis

react-native-phone-call's People

Contributors

brownmagik352 avatar douglasjunior avatar greenkeeper[bot] avatar imgbotapp avatar plahteenlahti avatar renovate-bot avatar tiaanduplessis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

react-native-phone-call's Issues

how can hide phone number when calling to that

I want's to hide phone number when calling to any number for my customer because my customer are taxi driver and they can call to the passenger but i want's the taxi driver can not see the passenger phone number when calling to that, is it possible ?

Missing declaration file

I am reporting this, because I was about to use this library in my project and I have just done the npm install --save react-native-phone-call.
When I do import call from 'react-native-phone-call I get a visual studio code error that tells me this:
image

I think you are missing what is there written in your index.js declaration. I will try to write that and give you a feed back, because the option of npm install @types/react-native-phone-call does not work and returns:
npm ERR! code E404
npm ERR! 404 Not Found: @types/react-native-phone-call@latest

If you have any idea why this could be happening, I will be glad to hear it from you.

Cannot add # in the phone number

While the number including #, the content after # is not visible in the dial pad.

const args = {
number: "*#123",
prompt: true
};

This show only * in the dial pad.

Expo

Is this compatible with expo, cos i have been trying to find it in the documentation

Call kills app

Attempting to make a call from my app kills the app on iOS 12

phone call intent with extension does not work

Calling 'call' method with number '9093900003,,,3,,,274' as provided in readme does not open intent with pauses and extension - those are simply stripped. I am not sure whether RN Linking actually supports uris with extensions.
Do you have any idea how to implement such behaviour or how to make you example working?

Call pop up with Name

Is it possible to add in a string like name, number ontop instead of just a number there?

11 vulnerabilities must be fixed manually

Hello,

I npm installed react-native-phone-call and the package manager alerted that there were 1666 high vulnerabilities and 11 low vulnerabilities to be fixed. I inserted "npm audit fix" and it fixed the high ones.

Now, it says: "11 vulnerabilities required manual review and could not be updated".

I'm using Expo. The report is:

Low Regular Expression Denial of Service

Package braces

Patched in >=2.3.1

Dependency of 261a5a0f90cf47bb4651d059c9a4782169305e0aad1a8cefc3ed9370dc0…

Path 261a5a0f90cf47bb4651d059c9a4782169305e0aad1a8cefc3ed9370dc0…
> @react-native-community/cli > metro > jest-haste-map >
micromatch > braces

More info https://npmjs.com/advisories/786

Low Regular Expression Denial of Service

Package braces

Patched in >=2.3.1

Dependency of 261a5a0f90cf47bb4651d059c9a4782169305e0aad1a8cefc3ed9370dc0…

Path 261a5a0f90cf47bb4651d059c9a4782169305e0aad1a8cefc3ed9370dc0…
> @react-native-community/cli > metro-config > metro >
jest-haste-map > micromatch > braces

More info https://npmjs.com/advisories/786

Low Regular Expression Denial of Service

Package braces

Patched in >=2.3.1

Dependency of 261a5a0f90cf47bb4651d059c9a4782169305e0aad1a8cefc3ed9370dc0…

Path 261a5a0f90cf47bb4651d059c9a4782169305e0aad1a8cefc3ed9370dc0…
> @react-native-community/cli > metro > metro-cache >
metro-core > jest-haste-map > micromatch > braces

More info https://npmjs.com/advisories/786

Low Regular Expression Denial of Service

Package braces

Patched in >=2.3.1

Dependency of 261a5a0f90cf47bb4651d059c9a4782169305e0aad1a8cefc3ed9370dc0…

Path 261a5a0f90cf47bb4651d059c9a4782169305e0aad1a8cefc3ed9370dc0…
> @react-native-community/cli > metro-config > metro >
metro-cache > metro-core > jest-haste-map > micromatch >
braces

More info https://npmjs.com/advisories/786

Low Regular Expression Denial of Service

Package braces

Patched in >=2.3.1

Dependency of 261a5a0f90cf47bb4651d059c9a4782169305e0aad1a8cefc3ed9370dc0…

Path 261a5a0f90cf47bb4651d059c9a4782169305e0aad1a8cefc3ed9370dc0…
> @react-native-community/cli > metro > metro-config >
metro-cache > metro-core > jest-haste-map > micromatch >
braces

More info https://npmjs.com/advisories/786

Low Regular Expression Denial of Service

Package braces

Patched in >=2.3.1

Dependency of 261a5a0f90cf47bb4651d059c9a4782169305e0aad1a8cefc3ed9370dc0…

Path 261a5a0f90cf47bb4651d059c9a4782169305e0aad1a8cefc3ed9370dc0…
> @react-native-community/cli > metro-config > metro-cache >
metro-core > jest-haste-map > micromatch > braces

More info https://npmjs.com/advisories/786

Low Regular Expression Denial of Service

Package braces

Patched in >=2.3.1

Dependency of 261a5a0f90cf47bb4651d059c9a4782169305e0aad1a8cefc3ed9370dc0…

Path 261a5a0f90cf47bb4651d059c9a4782169305e0aad1a8cefc3ed9370dc0…
> @react-native-community/cli > metro > metro-config >
metro-core > jest-haste-map > micromatch > braces

More info https://npmjs.com/advisories/786

Low Regular Expression Denial of Service

Package braces

Patched in >=2.3.1

Dependency of 261a5a0f90cf47bb4651d059c9a4782169305e0aad1a8cefc3ed9370dc0…

Path 261a5a0f90cf47bb4651d059c9a4782169305e0aad1a8cefc3ed9370dc0…
> @react-native-community/cli > metro-config > metro-core >
jest-haste-map > micromatch > braces

More info https://npmjs.com/advisories/786

Low Regular Expression Denial of Service

Package braces

Patched in >=2.3.1

Dependency of 261a5a0f90cf47bb4651d059c9a4782169305e0aad1a8cefc3ed9370dc0…

Path 261a5a0f90cf47bb4651d059c9a4782169305e0aad1a8cefc3ed9370dc0…
> @react-native-community/cli > metro > metro-core >
jest-haste-map > micromatch > braces

More info https://npmjs.com/advisories/786

Low Regular Expression Denial of Service

Package braces

Patched in >=2.3.1

Dependency of 261a5a0f90cf47bb4651d059c9a4782169305e0aad1a8cefc3ed9370dc0…

Path 261a5a0f90cf47bb4651d059c9a4782169305e0aad1a8cefc3ed9370dc0…
> @react-native-community/cli > metro-config > metro >
metro-core > jest-haste-map > micromatch > braces

More info https://npmjs.com/advisories/786

Low Regular Expression Denial of Service

Package braces

Patched in >=2.3.1

Dependency of 261a5a0f90cf47bb4651d059c9a4782169305e0aad1a8cefc3ed9370dc0…

Path 261a5a0f90cf47bb4651d059c9a4782169305e0aad1a8cefc3ed9370dc0…
> @react-native-community/cli > metro-core > jest-haste-map
> micromatch > braces

More info https://npmjs.com/advisories/786

found 11 low severity vulnerabilities in 37960 scanned packages
11 vulnerabilities require manual review. See the full report for details.

invalid URL provided: tel: xxxxxxxxxx

I noticed this error can happen on iOS simulator but I'm getting it on Android even if I build the APK or on Expo. It was working fine with Expo some weeks ago but now it's not anymore. I didn't change anything. It just stopped working.

const phoneargs = {
    number: 'xxxxxxxxxx',
    prompt: true
}

function handleCall() {
    console.log(phoneargs.number);
    call(phoneargs).catch(console.error);
}

return(
    <View style={styles.actionItem}>
         <Button
             icon={() => (
                 <MaterialIcons
                     name="phone-in-talk"
                     size={24}
                 />
             )}
              color="#333333"
              style={styles.actionBtn}
              onPress={handleCall}
          >
              <Text style={styles.itemInfo}>Call</Text>
          </Button>
    </View>
)

I tried changing the phone number my it just doesn't work.

Cannot access api docs

cannot access api documentation, i gave a look to the error in the network and it says "The downloaded package is not valid because it did not include TypeScript declaration files and there is no @types/* package published for it on the npm registry."

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.