I'm facing a weird behaviour on Samsung S9 (Android 9.0).
If I want to open contact form, name always is empty, no matter if I fill with familyName, middleName or givenName
createContact() {
const newPerson= {
recordID: "6b2237ee0df85980",
emailAddresses: [
{
label: "custom",
email: "[email protected]"
}
],
familyName: "Nietzsche",
givenName: "Friedrich",
phoneNumbers: [
{
label: "mobile",
number: "+99934122122"
}
],
hasThumbnail: false
};
Contacts.openContactForm(newPerson, (err, contact) => {
if (err) throw err;
});
}
The only fields are filled were: email and mobile phone
Any solution for that?
Thanks
Same here :/
is this only on Samsung Android 9.0. Please reproduce on other platforms and review the source code.
I've tested it on an Xperia XZ3 Android 9.0, Nexus 5X Android 9.0, Galaxy Nexus Android 8.1 and an other Galaxy Nexus Android 8.0.
Names are always empty :/
It works fine on IOS.
Thanks for your help!
ok sounds like an Android issue. The name is built here https://github.com/rt2zz/react-native-contacts/blob/45d66a95140a7376ba62e65750a8680733fa22b4/android/src/main/java/com/rt2zz/reactnativecontacts/ContactsManager.java#L331 and maybe it's overwritten here https://github.com/rt2zz/react-native-contacts/blob/45d66a95140a7376ba62e65750a8680733fa22b4/android/src/main/java/com/rt2zz/reactnativecontacts/ContactsManager.java#L397 try commenting the displayName bit
Doesn't work for me :/ Did it work for you?
Haven't tried it. I'll want to doublecheck the test app works on android https://github.com/morenoh149/react-native-contacts-test
Any solution for that?
@fgagneten none yet. PRs welcome.
works with displayName field
@morenoh149 How is this not documented? I had to use displayName to get the name to show. Should at least add this note in Open Contact Form, mentioning this if the name field appears empty.
Great library btw.
@Dror-Bar I never ran into this issue myself. This is a community project. Changes are welcome.
I have added a note to the readme. https://github.com/rt2zz/react-native-contacts/commit/09cb4372cde35e6780c1d729ed648c9b060fdcc7
Reviewing the source it does seem only the display name is passed down to the intent. At
https://github.com/rt2zz/react-native-contacts/blob/master/android/src/main/java/com/rt2zz/reactnativecontacts/ContactsManager.java#L397
Doesn't seem like intent.putParcelableArrayListExtra knows what to do with the name field
https://github.com/rt2zz/react-native-contacts/blob/master/android/src/main/java/com/rt2zz/reactnativecontacts/ContactsManager.java#L397
@morenoh149 Thanks for updating the readme.
Most helpful comment
works with
displayNamefield