🚀 DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more
Socket
Book a DemoInstallSign in
Socket

react-native-contact-form

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-contact-form

调用系统自带通讯录

latest
Source
npmnpm
Version
1.2.5
Version published
Maintainers
1
Created
Source

react-native-contact-form

npm version

调用系统自带通讯录

如果解决了您的问题,请点个🌟

If your problem is solved, please click🌟

Presentation

Installation

Using npm:

npm install react-native-contact-form --save

or using yarn:

yarn add react-native-contact-form
# RN >= 0.61.5
cd ios && pod install

Usage

import Contacts from 'react-native-contact-form'

Contacts.openContacts().then((res) => {
    res.phone = res.phone && res.phone.replace(/\s*/g, '');
    console.log(JSON.stringify(res)) // res: {name: '小伙子', phone: '15518720000'}
}, (error) => {
    console.log(error.message) // 获取联系人失败
})

Permissions

API 23+

Android requires allowing permissions with https://facebook.github.io/react-native/docs/permissionsandroid.html The READ_CONTACTS permission must be added to your main application's AndroidManifest.xml.

...
<uses-permission android:name="android.permission.READ_CONTACTS" />
...
API 22 and below

Add READ_PROFILE and/or WRITE_PROFILE permissions to AndroidManifest.xml

...
<uses-permission android:name="android.permission.READ_PROFILE" />
...

All RN versions

ios

Add kit specific "permission" keys to your Xcode Info.plist file, in order to make requestPermission work. Otherwise your app crashes when requesting the specific permission. Open Info.plist. Add key Privacy - Contacts Usage Description with your kit specific permission. The value for the key is optional in development. If you submit to the App Store the value must explain why you need this permission.

screen shot 2016-09-21 at 13 13 21
Accessing note filed on iOS 13 (optional)

If you'd like to read/write the contact's notes, call the iosEnableNotesUsage(true) method before accessing the contact infos. Also, a com.apple.developer.contacts.notes entitlement must be added to the project. Before submitting your app to the AppStore, the permission for using the entitlement has to be granted as well. You can find a more detailed explanation here.

Keywords

react-native

FAQs

Package last updated on 26 Feb 2021

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