react-native-contacts-android

1.1.3 • Public • Published

react-native-contacts-android

receiving contact from the phonebook

Install

  • npm install react-native-contacts-android --save
  • In android/setting.gradle
    ...
    include ':react-native-contacts-android'
    project(':react-native-contacts-android').projectDir = new File(settingsDir, '../node_modules/react-native-contacts-android')
  • In android/app/build.gradle
...
dependencies {
    ...
    compile project(':react-native-contacts-android')
}
  • register module (in android/app/src/main/java/[your-app-namespace]/MainActivity.java)
import ru.getintime.react_native_contacts_android.ReactNativeSelectContactsPackage; // <------ add import 
 
public class MainApplication extends Application implements ReactApplication  {
 
  @Override
    protected List<ReactPackage> getPackages() {
      ......
      return Arrays.<ReactPackage>asList(
          new MainReactPackage(),
          ......
          new ReactNativeSelectContactsPackage()
      );
    }
}
  • add Contacts permission (in android/app/src/main/AndroidManifest.xml)
...
  <uses-permission android:name="android.permission.READ_CONTACTS" />
...

Usage Example

import SelectContacts from 'react-native-contacts-android';
 
SelectContacts.picker((contact) => {
 
  ...
 
})

Contact

{
  "id": "2",
  "phones": [
    "id": "50",
    "number": "12344234"
  ]
}

Package Sidebar

Install

npm i react-native-contacts-android

Weekly Downloads

3

Version

1.1.3

License

MIT

Last publish

Collaborators

  • jenya26