I want to add to my application a button. So when is pressed, the phone's contacts application is opened, and the "Add contact" page is displayed with some data sent from the application.
How can I do that?
Update: After several weeks of investigation, I still have no idea about how to do this.
I tried with this library: https://github.com/rt2zz/react-native-contacts But it writes the contact directly to the contact list, without opening the contacts app.
Any help Will be super greatly appreciated
I am able to open native add to contact page using react-native-contacts.
link is here
Steps to do that
1. integrate react-native-contacts and make sure you follow all the steps and integrate correctly.
2. use below method to open it.
check openContactForm method of the library.
openContactPicker = () =>{
let number="1234567890"; //replace with any number
let newPerson = {
phoneNumbers: [{
label: "mobile",
number: number,
}],
};
Contacts.openContactForm(newPerson, (err) => {
if (err) console.warn(err) ;
// form is open
});
};
Note: contact we need to add should be a well-defined object that library recognizes. please check this
You Can Use wix-react-native-contacts npm package for your functionality.
refer this link
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With