Socket
Book a DemoInstallSign in
Socket

react-native-simple-contacts

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-simple-contacts

Simple access to contacts for iOS and Android

latest
Source
npmnpm
Version
1.0.2
Version published
Weekly downloads
43
-91.38%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-simple-contacts

This library is a work in progress. Additional features will be added as they become required.

Getting started

$ npm install react-native-simple-contacts --save

Mostly automatic installation

$ react-native link react-native-simple-contacts

Usage

import simpleContacts from 'react-native-simple-contacts';

// Get all contacts
simpleContacts.getContacts().then((contacts) => {
  // Do something with the contacts
});

// Get a specific contact based on a phone number
simpleContacts.findContactByNumber(number).then((contact) => {
  // Do something with the contact
});

// Get the user's profile
simpleContacts.getProfile().then((profile) => {
  // Do something with the profile
});

API

FunctionDescription
getContacts()Returns an array of contacts
getProfile()Return the user's profile.
findContactByNumber(number)Return the contact that matches the provided number.

Simple contacts only returns the following fields:

FieldDescription
keyA unique identifier
nameThe contact's display name
avatarThe contact's photo if available
numberThe contacts phone number

Returned contacts look like this:

const contact = {
  "key": "contact_###",
  "name": "John Doe",
  "avatar": "uri://picture",
  "number": "1-555-555-5555"
}

Manual installation

iOS

  • In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  • Go to node_modulesreact-native-simple-contacts and add BDVSimpleContacts.xcodeproj
  • In XCode, in the project navigator, select your project. Add libBDVSimpleContacts.a to your project's Build PhasesLink Binary With Libraries
  • Run your project (Cmd+R)<

Android

  • Open up android/app/src/main/java/[...]/MainActivity.java
  • Add import ca.bigdata.voice.contacts.BDVSimpleContactsPackage; to the imports at the top of the file
  • Add new BDVSimpleContactsPackage() to the list returned by the getPackages() method
  • Append the following lines to android/settings.gradle:
    include ':react-native-simple-contacts'
    project(':react-native-simple-contacts').projectDir = new File(rootProject.projectDir, 	'../node_modules/react-native-simple-contacts/android')
    
  • Insert the following lines inside the dependencies block in android/app/build.gradle:
      compile project(':react-native-simple-contacts')
    

Keywords

react-native contacts address addressbook simple phone number

FAQs

Package last updated on 31 Jan 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.