react-native-contacts
Advanced tools
Comparing version
@@ -41,2 +41,7 @@ export function getAll(callback: (error: any, contacts: Contact[]) => void): void; | ||
export interface InstantMessageAddress { | ||
username: string; | ||
service: string; | ||
} | ||
export interface Birthday { | ||
@@ -65,3 +70,4 @@ day: number; | ||
birthday: Birthday; | ||
imAddresses: InstantMessageAddress[] | ||
note: string; | ||
} |
@@ -7,3 +7,3 @@ { | ||
}, | ||
"version": "5.1.0", | ||
"version": "5.2.0", | ||
"description": "React Native Contacts (android & ios)", | ||
@@ -10,0 +10,0 @@ "nativePackage": true, |
@@ -9,3 +9,3 @@  | ||
`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. | ||
```es | ||
```js | ||
import Contacts from 'react-native-contacts'; | ||
@@ -24,3 +24,3 @@ | ||
On android you must request permissions beforehand | ||
```es | ||
```js | ||
import { PermissionsAndroid } from 'react-native'; | ||
@@ -199,3 +199,3 @@ import Contacts from 'react-native-contacts'; | ||
## Example Contact Record | ||
```es | ||
```js | ||
{ | ||
@@ -234,3 +234,7 @@ recordID: '6b2237ee0df85980', | ||
department: '', | ||
birthday: {'year': 1988, 'month': 0, 'day': 1 } | ||
birthday: {'year': 1988, 'month': 0, 'day': 1 }, | ||
imAddresses: [ | ||
{ username: '0123456789', service: 'ICQ'}, | ||
{ username: 'johndoe123', service: 'Facebook'} | ||
] | ||
} | ||
@@ -240,7 +244,6 @@ ``` | ||
* on Android versions below 8 the entire display name is passed in the `givenName` field. `middleName` and `familyName` will be `""`. | ||
* on iOS the note field is not available. | ||
## Adding Contacts | ||
Currently all fields from the contact record except for thumbnailPath are supported for writing | ||
```es | ||
```js | ||
var newPerson = { | ||
@@ -263,3 +266,3 @@ emailAddresses: [{ | ||
Currently all fields from the contact record except for thumbnailPath are supported for writing | ||
```es | ||
```js | ||
var newPerson = { | ||
@@ -282,3 +285,3 @@ emailAddresses: [{ | ||
Example | ||
```es | ||
```js | ||
Contacts.getAll((err, contacts) => { | ||
@@ -311,3 +314,3 @@ if (err) { | ||
You can delete a record using only it's recordID | ||
```es | ||
```js | ||
Contacts.deleteContact({recordID: 1}, (err, recordId) => { | ||
@@ -321,3 +324,3 @@ if (err) { | ||
Or by passing the full contact object with a `recordID` field. | ||
```es | ||
```js | ||
Contacts.deleteContact(contact, (err, recordId) => { | ||
@@ -335,3 +338,3 @@ if (err) { | ||
```es | ||
```js | ||
<Image source={{uri: contact.thumbnailPath}} /> | ||
@@ -345,3 +348,3 @@ ``` | ||
Usage as follows: | ||
```es | ||
```js | ||
Contacts.checkPermission((err, permission) => { | ||
@@ -348,0 +351,0 @@ if (err) throw err; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
223297
3.16%22
10%1825
4.82%387
0.78%0
-100%