npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

native-reactive-contacts

v1.0.6

Published

a module for interfacing with native device contacts

Downloads

1

Readme

Native Reactive Contacts :man: :ok_woman: :woman: :boy: :princess: :older_woman: :bow: :older_man:

Table of contents:

Install for iOS development

  • install the package via npm

    $ npm install native-reactive-contacts

go to <your_project>/node_modules/native-reactive-contacts/ and drag the native-reactive-contacts directory to your workspace or project file tree. Make sure that Copy items if needed is NOT checked!, select Create folder references and be sure that the sources are added to the correct target you wish to build against.

on iOS10 and onward, you must add an NSContactsUsageDescription key to your Info.plist. This provides the user some information as to why you wish to access private Contacts information.

```xml
<key>NSContactsUsageDescription</key>
<string>your message to the user advising of your apps contacts usage intent</string>
```

be sure the Contacts framework is added to your target build phase: build phase

Install for android development

coming soon! :confused:

Usage

Be sure to import NativeModules like so:

import { NativeModules } from 'react-native';

Expose this library to your component codebase:

var NativeReactiveContacts = NativeModules.NativeReactiveContacts;

Request for Contacts access:

NativeReactiveContacts.requestForContactsAccess((error, access) => {
	if (error) {
		console.log("error requesting access:" + error);
	} else {
		console.log("contacts access  " + JSON.stringify(access));
   }
});

CRUD Operations

CREATE a new contact:
	 let newContact = {
	 		"firstName": "James",
	 		"lastName": "Bond",
	 		"phone": "9495728219",
	 		"email": "[email protected]"
	}

NativeReactiveContacts.createContact(newContact, (resp) => {
	console.log("new contact created:" + JSON.stringify(resp));
});
/*
// your console should display the following:
new contact created: {"firstName":"James","lastName":"Bond","phone":"9495728219","email":"[email protected]"}
*/
READ all contacts from device:
NativeReactiveContacts.fetchAllContacts((obj) => {
	console.log("all contacts fetched" + JSON.stringify(obj)); // parse the object for use in your app!
});
/*
// example of Anna Haro from the default device contacts on iOS:
[{"familyName":"Haro","nickname":"Annie","organizationName":"","departmentName":"","imageDataAvailable":0,"namePrefix":"","nameSuffix":"","socialProfiles":[],"phoneNumbers":[null],"identifier":"0021C776-7782-4195-9D1D-7E0C3138A323","urlAddresses":[],"postalAddresses":null,"middleName":"","jobTitle":"","note":"","phoneticMiddleName":"","phoneticGivenName":"","phoneticFamilyName":"","emailAddresses":[{"label":"home","value":"[email protected]","identifier":"0732F1F5-35C3-44E7-AC7B-3515FDC50FA0"}]
*/
UPDATE a contact:
let updateInfo = {
	"givenName": "Joe",
	"familyName": "Jackson"
}

NativeReactiveContacts.updateContactById("349E0749-874E-4993-8AE0-FAE839DF2E34", updateInfo, (contactId, contactInfo) => {
	console.log("async response" + contactId + "info" + JSON.stringify(contactInfo));
});
DELETE an existing contact:
NativeReactiveContacts.deleteContact("678D06E9-1D7C-44F7-949D-CE1FC8068CB9",(response) => {
    console.log("contact deletion response: " + JSON.stringify(response));
});