# react-native-contact

> This is simple wrapper that return an array of contacts which can be handled by the developer for their specific use.

Latest version **0.0.8** (published 2019-11-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-native-contact
pnpm add react-native-contact
yarn add react-native-contact
bun add react-native-contact
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.8 |
| Published | 2019-11-05 |
| First published | 2019-11-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 180.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Sujeban Elankeswaran |
| Maintainers | sujeban |
| Keywords | react, react-native, contacts, address book, people, select contact |

## Links

- npm: https://www.npmjs.com/package/react-native-contact
- Repository: https://github.com/silentnerd/react-native-select-contact
- Homepage: https://github.com/silentnerd/react-native-select-contact.git
- Issues: https://github.com/silentnerd/react-native-select-contact.git/issues
- npm.io page: https://npm.io/package/react-native-contact

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.0.8 (latest) — 2019-11-05
- 0.0.7 — 2019-11-05
- 0.0.6 — 2019-11-05
- 0.0.5 — 2019-11-05
- 0.0.4 — 2019-11-05
- 0.0.3 — 2019-11-05
- 0.0.2 — 2019-11-05
- 0.0.1 — 2019-11-05
- 1.2.1 — 2019-11-05

## README

# react-native-contact

This is simple wrapper that return an array of contacts which can be handled by the developer for their specific use.

### Installation

```
yarn add react-native-contact
```

For React Native => 0.59 only:
```
react-native link react-native-contact
```

Make sure your manifest files includes permission to read contacts
```
<uses-permission android:name="android.permission.READ_CONTACTS" />
```

### API

#### Methods

```
selectContact(): Promise<Contact | null>;
selectContactPhone(): Promise<ContactPhoneSelection | null>;
selectContactEmail(): Promise<ContactEmailSelection | null>;
selectContactPostalAddress(): Promise<ContactPostalAddressSelection | null>;
```

These methods all will return an array. Which in turn can be handled by the developer for their specific need.

#### Types

```typescript
interface PhoneEntry {
    number: string,
    type: string
}

interface EmailEntry {
    address: string,
    type: string
}

interface AddressEntry {
    formattedAddress: string, // android only
    type: string, // android only
    street: string,
    city: string,
    state: string,
    postalCode: string,
    isoCountryCode: string
}

interface Contact {
    name: string,
    phones: PhoneEntry[],
    emails: EmailEntry[],
    postalAddresses: AddressEntry[]
}

interface ContactPhoneSelection {
    contact: Contact,
    selectedPhone: PhoneEntry
}

interface ContactEmailSelection {
    contact: Contact,
    selectedEmail: EmailEntry
}

interface ContactPostalAddressSelection {
    contact: Contact,
    selectedAddress: AddressEntry
}
```

### Example

```javascript

import { selectContactPhone } from 'react-native-contact';

function getPhoneNumber() {
    return selectContactPhone()
        .then(selection => {
            if (!selection) {
                return null;
            }
     
            console.log('Contact phone numbers: '+selection);
        });  
}


```

---
_Source: https://npm.io/package/react-native-contact · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
