Accessing Contacts on the iPhone

I am looking for a way to touch a button in my Expo app that will enable me to browse & search through my iPhone contacts. I want to select a single contact and then be able to use that contacts data in my Expo app.

It would be the identical function to creating a new text message in the ‘Messages’ app on the iPhone. You click the ‘+’ icon and it shows you the name of all your contacts.You can scroll and search and eventually touch on one and their name is filled into the ‘To:’ field.

I am not sure if I would have to write the GUI to search, display, scroll and pick a contact (duplicate the functionality seen in the Messages app) or if we could actually get Expo to launch that already existing functionality and somehow tie into it.

I have been unable to find any existing Expo apps that browse contacts on an iPhone.

Thanks guys.

Hi there! Expo doesn’t come with a prebuilt Contacts Picker interface. At the moment your best bet would be to implement the UI yourself and use the Contacts API to get the data from the device.

Ok thanks Ben.
Not the answer I was hoping for! but hey at least I know what to do next. Thanks

Still wondering…are there any Expo demos I can take a look at that access Contacts?

The docs have an example of accessing contacts: https://docs.expo.io/versions/latest/sdk/contacts.html#example

1 Like

Hey jesse,

I am aware of the docs and that code snippet, but I am looking to see a full example where I can see where this method should be placed, a caller calling it and then seeing an alert actually pop up in a demo Expo app.

I tried putting that async method (showFirstContactAsync) from the docs into the HomeScreen.js from the ‘Up and Running’ guide and I cannot get it to work, here is where I am now

https://sketch.expo.io/BkPodr8oe

Here’s an example of loading the first contact: https://sketch.expo.io/SkuzWUIje

One note: our contact api isn’t paginated currently so if you have a long list of contacts it can be slow. We’re looking into this soon.

1 Like

Thanks Jesse.

I can see a contact now. Much appreciated

1 Like