jontacky / react-native-contact-picker

Contact Picker for react native

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

react-native-contact-picker

  • Support to open contact sheet and select a user and get their emails back.
Library React Native
4 47+
3 40-46
2 <=39

Getting started

npm install doctadre/react-native-contact-picker

iOS

  1. In XCode, in the project navigator, right click your projectAdd Files to [your project's name]
  2. Go to node_modulesreact-native-contact-picker and add ContactPicker.m
  3. In XCode, open the Info.plist file and add a Privacy - Contacts Usage Description key/value
  4. Run your project (Cmd+R)

Android

if you do not have rnpm: npm install rnpm -g

rnpm link react-native-contact-picker

In AndroidManifest.xml

   <!--add contact picker permissions-->
   <uses-permission android:name="android.permission.READ_CONTACTS"/>

Usage

Require the module var ContactPicker = require('NativeModules').ContactPicker;

'use strict';

var React = require('react-native');
var ContactPicker = require('NativeModules').ContactPicker;

then invoke:

    onButtonPress() {
        ContactPicker.pickContact().then((emails) => {
            if (emails && emails.length) {
                // list of contacts emails as strings
            } else {
             // either user hit cancel or the person they picked has no emails
            }
        });
    }

License

MIT

About

Contact Picker for react native

License:MIT License


Languages

Language:Java 60.7%Language:Objective-C 37.8%Language:JavaScript 1.4%