Skip to content

Commit

Permalink
Merge pull request #458 from zhirzh/patch-1
Browse files Browse the repository at this point in the history
fix syntax highlighting
  • Loading branch information
morenoh149 authored Mar 11, 2020
2 parents 6f56ccb + 808bd5a commit fd68dab
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Ask questions on [stackoverflow](https://stackoverflow.com/questions/tagged/reac

## 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.
```es
```js
import Contacts from 'react-native-contacts';

Contacts.getAll((err, contacts) => {
Expand All @@ -20,7 +20,7 @@ See the full [API](#api) for more methods.

### Android permissions
On android you must request permissions beforehand
```es
```js
import { PermissionsAndroid } from 'react-native';
import Contacts from 'react-native-contacts';

Expand Down Expand Up @@ -194,7 +194,7 @@ callback <Function>
```

## Example Contact Record
```es
```js
{
recordID: '6b2237ee0df85980',
backTitle: '',
Expand Down Expand Up @@ -237,7 +237,7 @@ callback <Function>

## Adding Contacts
Currently all fields from the contact record except for thumbnailPath are supported for writing
```es
```js
var newPerson = {
emailAddresses: [{
label: "work",
Expand All @@ -255,7 +255,7 @@ Contacts.addContact(newPerson, (err) => {

## Open Contact Form
Currently all fields from the contact record except for thumbnailPath are supported for writing
```es
```js
var newPerson = {
emailAddresses: [{
label: "work",
Expand All @@ -273,7 +273,7 @@ You may want to edit the contact before saving it into your phone book. So using

## Updating Contacts
Example
```es
```js
Contacts.getAll((err, contacts) => {
if (err) {
throw err;
Expand Down Expand Up @@ -301,7 +301,7 @@ See https://github.com/rt2zz/react-native-contacts/issues/332#issuecomment-45567

## Delete Contacts
You can delete a record using only it's recordID
```es
```js
Contacts.deleteContact({recordID: 1}, (err, recordId) => {
if (err) {
throw err;
Expand All @@ -310,7 +310,7 @@ Contacts.deleteContact({recordID: 1}, (err, recordId) => {
})
```
Or by passing the full contact object with a `recordID` field.
```es
```js
Contacts.deleteContact(contact, (err, recordId) => {
if (err) {
throw err;
Expand All @@ -323,7 +323,7 @@ Contacts.deleteContact(contact, (err, recordId) => {

The thumbnailPath is the direct URI for the temp location of the contact's cropped thumbnail image.

```es
```js
<Image source={{uri: contact.thumbnailPath}} />
```

Expand All @@ -332,7 +332,7 @@ The thumbnailPath is the direct URI for the temp location of the contact's cropp
`requestPermission` (callback) - request permission to access Contacts.

Usage as follows:
```es
```js
Contacts.checkPermission((err, permission) => {
if (err) throw err;

Expand Down

0 comments on commit fd68dab

Please sign in to comment.