ReactNativeContacts

  • [GitHub storage address](github.com/morenoh149/…)

ReactNativeContacts instructions

With this component you can add, delete, change and check the phone address book.

The installation

npm

npm install react-native-contacts --save

Copy the code

yarn

yarn add react-native-contacts

Copy the code

Android configuration

  1. In android/settings.gradle
. include ':react-native-contacts' project(':react-native-contacts').projectDir = new File(rootProject.projectDir, '.. /node_modules/react-native-contacts/android')Copy the code
  1. In android/app/build.gradle
. dependencies { ... implementation project(':react-native-contacts') }Copy the code
  1. If your React Native version is greater than or equal to 0.60, do not perform the following registration operations.
//  MainApplication.java
import com.rt2zz.reactnativecontacts.ReactNativeContacts; // <--- import

public class MainApplication extends Application implements ReactApplication {
  ......

  @Override
  protected List<ReactPackage> getPackages() {
    return Arrays.<ReactPackage>asList(
            new MainReactPackage(),
            new ReactNativeContacts()); // <------ add this
  }
  ......
}

Copy the code

Access configuration

Configuration file directory: Android \app\ SRC \main\ Androidmanifest.xml

<uses-permission android: />

Copy the code

API 22 and below

Add READ_CONTACTS and/or WRITE_PROFILE permissions to AndroidManifest.xml

<uses-permission android: />


Copy the code