Registry / communication / react-native-contacts

react-native-contacts

JSON →
library8.0.10jsnpmunverified

React Native Contacts is a JavaScript library for React Native applications, providing cross-platform access to the device's contact list on both Android and iOS. The current stable version is 8.0.10. While not on a fixed release schedule, the library sees regular maintenance and bug fixes, with recent updates (like v8.0.0) focusing on compatibility with the new React Native architecture (TurboModules and Fabric). It also provides fixes for compatibility with older legacy bridge projects (v8.0.9, v8.0.10). Key differentiators include its long-standing support for both major mobile platforms, straightforward API for retrieving, adding, and updating contacts, and handling of native permissions. Users should be aware of performance considerations when using `getAll` and specific installation steps tailored for different React Native versions and architectures.

npm install react-native-contacts
INSTALL
IMPORT
SIG · REACT-NATIVE-CONTA
R
react-native-contacts
communicationjavascriptv8.0.10
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Contacts
import Contacts from 'react-native-contacts';
const Contacts = require('react-native-contacts');
Primarily designed for ESM. CommonJS `require` can lead to issues with newer React Native architectures or build systems.
Contact
import type { Contact } from 'react-native-contacts';
Type import for TypeScript users to define contact shape.
{ getAll }
import Contacts from 'react-native-contacts'; // then use: Contacts.getAll()
import { getAll } from 'react-native-contacts';
`getAll` is a method of the default `Contacts` object, not a named export. Attempting to destructure it directly will result in an undefined function.

This quickstart demonstrates how to request Android runtime permissions for contacts and then fetch all contacts using `Contacts.getAll()`.

import { PermissionsAndroid } from 'react-native'; import Contacts from 'react-native-contacts'; const fetchContacts = async () => { try { const granted = await PermissionsAndroid.request( PermissionsAndroid.PERMISSIONS.READ_CONTACTS, { title: 'Contacts', message: 'This app would like to view your contacts.', buttonPositive: 'Please accept bare mortal', } ); if (granted === PermissionsAndroid.RESULTS.GRANTED) { console.log('Contacts permission granted.'); const contacts = await Contacts.getAll(); console.log('Fetched contacts:', contacts.slice(0, 3)); // Log first 3 contacts // Example: Access a specific contact's phone number if (contacts.length > 0 && contacts[0].phoneNumbers && contacts[0].phoneNumbers.length > 0) { console.log('First contact phone number:', contacts[0].phoneNumbers[0].number); } } else { console.log('Contacts permission denied.'); } } catch (err) { console.error('Error fetching contacts:', err); } }; fetchContacts();
Debug
Known issues
breakingStarting with v7.0.0, manual linking (e.g., `react-native link`) and including a manual pod line in the `Podfile` for iOS projects are no longer needed due to autolinking support. Retaining the old pod line can cause build failures.
fix
Remove `pod 'react-native-contacts'` from your `ios/Podfile` if it exists. Run `npx react-native unlink react-native-contacts` if previously linked, then `npm install react-native-contacts` and `cd ios && pod install`.
affects: >=7.0.0
breakingVersion 8.0.0 introduced initial support for the new React Native architecture (TurboModules and Fabric). While aiming for backward compatibility, projects migrating to the new architecture or using React Native versions that leverage it should follow specific installation and linking steps.
fix
For React Native 0.60+ (and especially with new architecture enabled), ensure `pod 'react-native-contacts', :path => '../node_modules/react-native-contacts'` is present in your `ios/Podfile` and run `pod install`. For Android, ensure `android/settings.gradle` and `android/app/build.gradle` are correctly configured for autolinking or manual linking if below RN 0.60.
affects: >=8.0.0
breakingFor React Native versions 0.60 and above, AndroidX support is required. `react-native-contacts` versions 5.x+ include AndroidX support. If you are using React Native 0.59 or below, you must use `react-native-contacts` versions 4.x or older to avoid Android build conflicts.
fix
If using RN 0.60+, ensure your project has migrated to AndroidX. If using RN < 0.60, downgrade `react-native-contacts` to `4.x.x` (e.g., `npm install react-native-contacts@4`).
affects: >=5.0.0
gotchaThe `Contacts.getAll()` method is a database-intensive process, and its execution time can be significant, especially with large contact lists. Calling it frequently or synchronously can degrade app performance.
fix
It is highly recommended to call `getAll()` before the data is critically needed and cache the results for subsequent uses. Consider implementing a loading state or background process for contact retrieval.
affects: *
gotchaOn iOS, you must add 'Privacy - Contacts Usage Description' (NSContactsUsageDescription) key to your `Info.plist` file with a descriptive string, otherwise your app will crash when attempting to access contacts.
fix
Add the `NSContactsUsageDescription` key and a user-facing message to your `Info.plist` file in Xcode.
affects: *
Errors
Common errors & fixes
Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)
This error frequently indicates a linking issue where native modules are not correctly registered with the JavaScript bridge.
fix
Ensure `react-native-contacts` is properly linked for your React Native version and platform. For RN 0.60+, run `cd ios && pod install` after adding the pod line. For Android, verify `settings.gradle` and `app/build.gradle` configurations. Clean caches: `watchman watch-del-all && rm -rf node_modules && npm install && cd ios && pod install && cd .. && npm start -- --reset-cache`.
Execution failed for task ':app:processDebugMainManifest'. > Manifest merger failed with multiple errors, see logs.
This often occurs on Android when `react-native-contacts` versions 5.x+ are used with a React Native project that has not migrated to AndroidX (typically RN < 0.60).
fix
Migrate your React Native project to AndroidX if using RN 0.60+. If you must use RN < 0.60, downgrade `react-native-contacts` to a `4.x.x` version by running `npm install react-native-contacts@4`.
error: library not found for -lRCTContacts
This iOS build error indicates that the `RCTContacts` native library could not be found, typically due to incorrect or missing linking.
fix
For React Native 0.60+, ensure `pod 'react-native-contacts', :path => '../node_modules/react-native-contacts'` is added to your `ios/Podfile` inside your target, then run `cd ios && pod install`. For older RN versions, verify manual linking steps (dragging `RCTContacts.xcodeproj` to `Libraries` and linking `libRCTContacts.a` in Build Phases).
Upgrade
Version history
8.0.10latest on npm
Audit
Dependencies
react-nativerequiredPeer dependency for React Native application environment.
reactrequiredPeer dependency for React component model.
Agent activity
20 hits · last 30 days
node
16
Amazon
1
OpenAI (training)
1
Resources
react-native-contacts — npm install react-native-contacts · libregistry