React-native-contacts: Empty name on Android 9

Created on 7 Mar 2019  路  12Comments  路  Source: morenoh149/react-native-contacts

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

Most helpful comment

works with displayName field

All 12 comments

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!

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.

Was this page helpful?
0 / 5 - 0 ratings