Overview
The react-native-contacts library provides a way to access and interact with device contacts in React Native applications. It offers methods to fetch contacts efficiently and handle permissions on both Android and iOS platforms.
Features
- Database Intensive Process: Accessing all contacts can be time-consuming, so it’s recommended to cache results for future use.
- Android Permissions: Guide on handling permissions for reading and writing contacts on Android.
- iOS Installation: Steps to integrate the library into iOS projects with guidance on permissions.
Installation
npm/yarn:
- For versions V7.0.0+, autolinking is supported.
- For versions < V7.0.0, follow manual linking steps as per documentation.
iOS Integration (React Native 0.60+):
- Add a line in ios/Podfile.
- Run
pod installin ios folder.
React Native < 0.60 (iOS):
- Follow manual linking instructions as documented.
Add to iOS Project:
- Open Xcode, drag the project file to Libraries, and include the library in Build Phases.
Adding Camera Roll to iOS Project:
- Run the app via Xcode or terminal command
react-native run-ios.
Android X Support:
- Required for React Native 0.60+, added in react-native-contacts 5.x+.
- For RN versions below 0.60, use rnc versions 4.x.
Permissions (Android):
- Handle permissions for Android APIs 22+ and 23+ as per React Native documentation.
ProGuard and iOS Permissions:
- Ensure ProGuard settings are configured.
- Add specific permission keys to Xcode Info.plist file for requesting contacts permissions.
Accessing Note Field (iOS 13):
- Enable note access using
iosEnableNotesUsage(true)method before accessing contact info.
Summary
The react-native-contacts library simplifies contact management in React Native apps, offering features like efficient contact retrieval, guidance on permissions handling for Android and iOS, steps for installation and integration, and specific considerations for iOS 13 access requirements. Developers can utilize this library to efficiently interact with device contacts and enhance user experience in their applications.