Search code examples
reactjsreact-nativecontactsreact-native-contacts

React Native: Save Multiple contacts to phone contacts


I have lists of contacts in array. Now I want to save that contacts in my phone contacts using react-native-contacts library. So Is it possible to achieve this functionality using react-native-contacts package or any other package.

Using react-native-contacts we can save one contacts at a time using openContactForm(). But what if save more than one contact at a time.

Please help me out with this issue. I have checked all package but no luck.


Solution

  • openContactForm() is not the method you're looking for as it requires the user to enter contact details by hand. react-native-contacts provides an addContact(contact) API where you can store a contact directly to the phones address book. So for an array of contacts you can use something like this:

    for (contact in contactArray) {
      addContact(contact);
    }