Closed theshilovs closed 5 months ago
looks like the starred option is never unpacked on android
import android.provider.ContactsContract.ContactOptionsColumns
@ReactMethod
public void addContact(ReadableMap contact, Promise promise) {
if (contact == null) {
promise.reject("New contact cannot be null.");
return;
}
String givenName = contact.hasKey("givenName") ? contact.getString("givenName") : null;
String middleName = contact.hasKey("middleName") ? contact.getString("middleName") : null;
String familyName = contact.hasKey("familyName") ? contact.getString("familyName") : null;
String prefix = contact.hasKey("prefix") ? contact.getString("prefix") : null;
...
Hello! I might have a similar issue to address here. I noticed that the isStarred
property though present on the example contact record is not showing on the Contact
interface provided by the library:
export interface Contact {
recordID: string;
backTitle: string;
company: string|null;
emailAddresses: EmailAddress[];
displayName: string;
familyName: string;
givenName: string;
middleName: string;
jobTitle: string;
phoneNumbers: PhoneNumber[];
hasThumbnail: boolean;
thumbnailPath: string;
postalAddresses: PostalAddress[];
prefix: string;
suffix: string;
department: string;
birthday: Birthday;
imAddresses: InstantMessageAddress[]
note: string;
}
Is there a reason for this? Has this property been recently unsupported? Is it because this property is only supposed to be available on Android devices?
Thanks!
@ayelenguini its just an oversight. When we first wrote the example we did not support typescript. Ts annotations were added later by another author. isStarred should be added to the ts definition but we should also check that they are properly set when creating a new contact.
@morenoh149 and what about when requesting the contact list itself? would this property be available on the return object? is it only available on android?
@ayelenguini it's probably missing when requesting the contact list itself as well
This issue is stale, please provide more information about the status
Thanks for the library!
Android, "react": "18.2.0", "react-native-contacts": "^7.0.8",
LOG {"company": null, "department": null, "displayName": "test test", "emailAddresses": [], "familyName": "test", "givenName": "test", "hasThumbnail": false, "imAddresses": [], "isStarred": false, "jobTitle": null, "middleName": "", "note": null, "phoneNumbers": [], "postalAddresses": [], "prefix": null, "rawContactId": "4765", "recordID": "4766", "suffix": null, "thumbnailPath": "", "urlAddresses": []} CONTACTPHONE
How is it?