This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
Expo Contacts (legacy)
A library that provides access to the phone's system contacts.
The
legacyversion of Contacts API included onexpo-contactslibrary. It can be used alongside class-basedexpo-contactsAPI, which is exposed from root. To use the legacy API, import it fromexpo-contacts/legacy.
expo-contacts provides access to the device's system contacts, allowing you to get contact information as well as adding, editing, or removing contacts.
On iOS, contacts have a multi-layered grouping system that you can also access through this API.
Installation
If you are installing this in an existing React Native app, make sure to install expo in your project.
Configuration in app config
You can configure expo-contacts using its built-in config plugin if you use config plugins in your project (Continuous Native Generation (CNG)). The plugin allows you to configure various properties that cannot be set at runtime and require building a new app binary to take effect. If your app does not use CNG, then you'll need to manually configure the library.
Example app.json with config plugin
Configurable properties
Are you using this library in an existing React Native app?
If you're not using Continuous Native Generation (CNG) (you're using native android and ios projects manually), then you need to configure following permissions in your native projects:
-
For Android, add
android.permission.READ_CONTACTSandandroid.permission.WRITE_CONTACTSpermissions to your project's android/app/src/main/AndroidManifest.xml:<uses-permission android:name="android.permission.READ_CONTACTS" /> <uses-permission android:name="android.permission.WRITE_CONTACTS" /> -
For iOS, add the
NSContactsUsageDescriptionkey to your project's ios/[app]/Info.plist:<key>NSContactsUsageDescription</key> <string>Allow $(PRODUCT_NAME) to access your contacts</string>
Usage
API
import * as Contacts from 'expo-contacts/legacy';
Component
Type: React.PureComponent<ContactAccessButtonProps>
Creates a contact access button to quickly add contacts under limited-access authorization.
For more details, you can read the Apple docs about the underlying ContactAccessButton SwiftUI view.
ColorValueA color of the button's background. Provided color should not be transparent, otherwise it may not satisfy platform requirements for button legibility.
stringWhen the query produces a single result, the contact access button shows the caption under the matching contact name. It can be nothing (default), email address or phone number.
Acceptable values are: 'default' | 'email' | 'phone'
string[]An array of email addresses. The search omits contacts matching query that also match any email address in this array.
string[]An array of phone numbers. The search omits contacts matching query that also match any phone number in this set.
stringA string to match against contacts not yet exposed to the app. You typically get this value from a search UI that your app presents, like a text field.
ColorValueA color of the button's title. Slightly dimmed version of this color is used for the caption text. Make sure there is a good contrast between the text and the background, otherwise platform requirements for button legibility may not be satisfied.
ColorValueA tint color of the button and the modal that is presented when there is more than one match.
Static methods
Returns a boolean whether the ContactAccessButton is available on the platform.
This is true only on iOS 18.0 and newer.
booleanConstants
Methods
Promise<string>Promise<ContactsPermissionResponse>Promise<boolean>Promise<boolean>Promise<string[]>Promise<ExistingContact | null>Promise<ContactsPermissionResponse>Event subscriptions
Types
Literal type: union
Acceptable values are: CalendarFormats | {CalendarFormats}
String union of SortTypes values.
Literal type: union
Permission expiration time. Currently, all permissions are granted permanently.
Acceptable values are: 'never' | number
Enums
Permissions
Android
This library automatically adds READ_CONTACTS and WRITE_CONTACTS permissions to your app:
iOS
The following usage description keys are used by this library: