1.0.2 • Published 5 years ago
react-native-phone-caller v1.0.2
react-native-phone-caller
React Native phone calls for iOS and Android
Getting started
$ npm install --save react-native-phone-caller
or
$ yarn add react-native-phone-caller
Mostly automatic installation
$ react-native link react-native-phone-caller
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-phone-caller
and addRNPhoneCaller.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNPhoneCaller.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
Android
- Open up
android/app/src/main/java/[...]/MainApplication.java
- Add
import com.PhoneCaller.RNPhoneCallerPackage;
to the imports at the top of the file Add
new RNPhoneCallerPackage()
to the list returned by thegetPackages()
methodimport com.PhoneCaller.RNPhoneCallerPackage; // <--- 1 public class MainApplication extends Application implements ReactApplication { private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { @Override protected boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } @Override protected List<ReactPackage> getPackages() { return Arrays.<ReactPackage>asList( new MainReactPackage(), new RNPhoneCallerPackage() // <--- 2 ); } }; ....
- Append the following lines to
android/settings.gradle
:include ':react-native-phone-caller' project(':react-native-phone-caller').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-phone-caller/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:implementation project(':react-native-phone-caller')
Usage
PhoneCaller.call(tel)
Arguments:
- tel: String - a phone number to call
Returns: Promise
- fulfilled: String -
Success
- rejected: Error
import PhoneCaller from 'react-native-phone-caller';
PhoneCaller.call('+98887776655');