Socket
Socket
Sign inDemoInstall

react-native-contacts

Package Overview
Dependencies
Maintainers
3
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-contacts - npm Package Compare versions

Comparing version 0.8.0 to 0.8.1

CONTRIBUTING.md

2

package.json

@@ -7,3 +7,3 @@ {

},
"version": "0.8.0",
"version": "0.8.1",
"description": "React Native Contacts (android & ios)",

@@ -10,0 +10,0 @@ "nativePackage": true,

# React Native Contacts
To contribute read [CONTRIBUTING.md](https://github.com/rt2zz/react-native-contacts).
Rx support with [react-native-contacts-rx](https://github.com/JeanLebrument/react-native-contacts-rx)
## Usage
`getAll` is a database intensive process, and can take a long time to complete depending on the size of the contacts list. Because of this, it is recommended you access the `getAll` method before it is needed, and cache the results for future use.
Also there is a lot of room for performance enhancements in both iOS and android. PR's welcome!
```js
var Contacts = require('react-native-contacts')
Contacts.getAll((err, contacts) => {
if(err && err.type === 'permissionDenied'){
// x.x
} else {
console.log(contacts)
}
})
```
## Installation
run `npm install react-native-contacts`
### iOS
1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`
2. add `./node_modules/react-native-contacts/ios/RCTContacts.xcodeproj`
3. In the XCode project navigator, select your project, select the `Build Phases` tab and in the `Link Binary With Libraries` section add **libRCTContacts.a**
#### Permissions
As of Xcode 8 and React Native 0.33 it is now **necessary to 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. I discovered this after days of frustration.
Open Xcode > Info.plist > Add a key (starting with "Privacy - ...") with your kit specific permission. The value for the key is optional.
You have to add the key "Privacy - Contacts Usage Description".
<img width="338" alt="screen shot 2016-09-21 at 13 13 21" src="https://cloud.githubusercontent.com/assets/5707542/18704973/3cde3b44-7ffd-11e6-918b-63888e33f983.png">
### Android
_For versions of RN before [v0.21.0](https://github.com/facebook/react-native/releases/tag/v0.21.0) use the [old instructions](https://github.com/rt2zz/react-native-contacts/tree/1ce4b876a416bc2ca3c53e7d7e0296f7fcb7ce40#android)._
* In `android/settings.gradle`
```gradle
...
include ':react-native-contacts'
project(':react-native-contacts').projectDir = new File(settingsDir, '../node_modules/react-native-contacts/android')
```
* In `android/app/build.gradle`
```gradle
...
dependencies {
...
compile project(':react-native-contacts')
}
```
* register module (in android/app/src/main/java/com/[your-app-name]/MainApplication.java)
```java
...
import com.rt2zz.reactnativecontacts.ReactNativeContacts; // <--- import module!
public class MainApplication extends Application implements ReactApplication {
...
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new ReactNativeContacts() // <--- and add package
);
}
...
}
```
* add Contacts permission (in android/app/src/main/AndroidManifest.xml)
* only add the permissions you need
* `READ_PROFILE` may be a required for other permissions
```xml
...
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
...
```
## Status

@@ -29,19 +117,2 @@ * Preliminary iOS and Android support

## Usage
`getAll` is a database intensive process, and can take a long time to complete depending on the size of the contacts list. Because of this, it is recommended you access the `getAll` method before it is needed, and cache the results for future use.
Also there is a lot of room for performance enhancements in both iOS and android. PR's welcome!
```js
var Contacts = require('react-native-contacts')
Contacts.getAll((err, contacts) => {
if(err && err.type === 'permissionDenied'){
// x.x
} else {
console.log(contacts)
}
})
```
## Example Contact Record

@@ -124,68 +195,2 @@ ```js

## Getting started
run `npm install react-native-contacts`
### iOS
1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`
2. add `./node_modules/react-native-contacts/ios/RCTContacts.xcodeproj`
3. In the XCode project navigator, select your project, select the `Build Phases` tab and in the `Link Binary With Libraries` section add **libRCTContacts.a**
#### Permissions
As of Xcode 8 and React Native 0.33 it is now **necessary to 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. I discovered this after days of frustration.
Open Xcode > Info.plist > Add a key (starting with "Privacy - ...") with your kit specific permission. The value for the key is optional.
You have to add the key "Privacy - Contacts Usage Description".
<img width="338" alt="screen shot 2016-09-21 at 13 13 21" src="https://cloud.githubusercontent.com/assets/5707542/18704973/3cde3b44-7ffd-11e6-918b-63888e33f983.png">
### Android
* In `android/settings.gradle`
```gradle
...
include ':react-native-contacts'
project(':react-native-contacts').projectDir = new File(settingsDir, '../node_modules/react-native-contacts/android')
```
* In `android/app/build.gradle`
```gradle
...
dependencies {
...
compile project(':react-native-contacts')
}
```
* register module (in android/app/src/main/java/com/[your-app-name]/MainApplication.java)
```java
...
import com.rt2zz.reactnativecontacts.ReactNativeContacts; // <--- import module!
public class MainApplication extends Application implements ReactApplication {
...
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new ReactNativeContacts() // <--- and add package
);
}
...
}
```
If you are using a version of RN before [v0.21.0](https://github.com/facebook/react-native/releases/tag/v0.21.0) please see the [old instructions](https://github.com/rt2zz/react-native-contacts/tree/1ce4b876a416bc2ca3c53e7d7e0296f7fcb7ce40#android).
* add Contacts permission (in android/app/src/main/AndroidManifest.xml)
(only add the permissions you need)
```xml
...
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
...
```
## Permissions Methods (optional)

@@ -192,0 +197,0 @@ `checkPermission` (callback) - checks permission to access Contacts.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc