You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

咨询:Expo SDK v29.0.0联系人原生模态框API为何未在文档中找到?

Answer

Great question! I totally get the confusion here — when Expo SDK 29 first launched, that native contact modal feature was a bit hidden in the existing Contacts API, and the official docs didn’t highlight it super clearly at first.

You didn’t miss anything major; those modal functions are actually built into two under-documented (at the time) methods of the expo-contacts module:

  • View/Select Contacts: Use Contacts.pickContactAsync() — this triggers the system’s native contact picker modal, lets users select a contact, and returns the full contact data once they confirm.
  • Create/Edit Contacts: Use Contacts.presentFormAsync(contactData) — pass in a contact object (empty for a new contact, or an existing contact to edit), and it’ll open the system’s native contact edit/form modal. After the user finishes editing, it returns the updated contact details (or confirms if the user canceled the action).

Here’s a quick example to show how to use the create/edit modal:

import * as Contacts from 'expo-contacts';

async function openContactForm() {
  // First, request necessary permissions
  const { status } = await Contacts.requestPermissionsAsync();
  if (status !== 'granted') {
    alert('Need contacts permission to use this feature!');
    return;
  }

  // Open modal to create a new contact (pass existing contact to edit)
  const result = await Contacts.presentFormAsync({
    firstName: 'Jane',
    lastName: 'Smith',
    phoneNumbers: [{ number: '555-1234' }],
  });

  if (!result.canceled) {
    console.log('Updated/created contact:', result.contact);
  } else {
    console.log('User canceled the contact form');
  }
}

A heads-up: If you’re looking at older versions of the Expo docs, these methods might not be prominently featured, but they’ve been part of the expo-contacts module since SDK 29. Double-check the latest version of the docs for full details on parameters and return values.

内容的提问来源于stack exchange,提问作者arnaudambro

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.11 08:50:18