How to use the expo-contacts.Fields.PhoneNumbers function in expo-contacts

To help you get started, we’ve selected a few expo-contacts examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github celo-org / celo-monorepo / packages / dappkit / src / index.ts View on Github external
export async function fetchContacts(
  kit: ContractKit
): Promise<{ rawContacts: ContactsById; phoneNumbersByAddress: PhoneNumberMappingEntryByAddress }> {
  const contacts = await getContactsAsync({
    fields: [Fields.PhoneNumbers, Fields.Image],
  })

  const filteredContacts = contacts.data.filter((contact) => {
    return (
      contact.phoneNumbers && find(contact.phoneNumbers, (p) => isValidPhoneNumber(p) !== undefined)
    )
  })

  const rawContacts = fromPairs(filteredContacts.map((contact) => [contact.id, contact]))

  // @ts-ignore
  const phoneNumbersToContacts = createPhoneNumberToContactMapping(filteredContacts)

  const phoneNumbersByAddress = await lookupPhoneNumbersOnAttestations(kit, phoneNumbersToContacts)

  return {