React Native custom module to get contact list with Kotlin (Android) and Swift (iOS)
iOS | Android |
---|---|
npm install rn-contacts
import { getAllContacts } from "rn-contacts";
// ...
const fetchContacts = async () => {
try {
const result = await getAllContacts();
} catch(e) {
console.log(e);
}
}
You can also check the 👉 example 👈 implementation
Add kit specific "permission" keys to your Xcode Info.plist
file, in order to make requestPermission work. Otherwise your app crashes when requesting the specific permission.
- Open
Info.plist
. - Add key
Privacy - Contacts Usage Description
with your kit specific permission.- The value for the key is optional in development. If you submit to the App Store the value must explain why you need this permission.
Android requires allowing permissions with the READ_CONTACTS
permission must be added to your main application's AndroidManifest.xml
.
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
- iOS module (Swift)
- Android module (Kotlin)
- Example with Typescript
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT