This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
This is documentation for the next SDK version. For up-to-date documentation, see the latest version (SDK 57).
日期选择器
一个用于选择日期和时间的 SwiftUI 日期选择器组件。
iOS
Included in Expo Go
Expo UI DatePicker 与官方 SwiftUI DatePicker API 一致,并支持通过 datePickerStyle 修饰符进行样式设置。


安装
Terminal
If you are installing this in an existing React Native app, make sure to install expo in your project.
日期选择器
DatePickerExample.tsx
时间选择器
TimePickerExample.tsx
日期和时间选择器
DateTimePickerExample.tsx
使用日期范围
DateRangePickerExample.tsx
使用修饰符设置样式
你可以使用 datePickerStyle 修饰符来更改选择器的外观。可用样式包括:automatic、compact、graphical 和 wheel。
WheelDatePickerExample.tsx
GraphicalDatePickerExample.tsx
禁用的选择器
你可以使用 disabled 修饰符使选择器不可交互。
DisabledDatePickerExample.tsx
自定义区域设置
使用带有 locale 键的 environment 修饰符,以特定区域设置显示选择器。
LocaleDatePickerExample.tsx
自定义时区
使用带有 timeZone 键的 environment 修饰符,以特定的 IANA 时区显示选择器。
TimeZoneDatePickerExample.tsx
API
import { DatePicker } from '@expo/ui/swift-ui';
Component
Type: React.Element<DatePickerProps>
Renders a SwiftUI DatePicker component.
Optional • Type:
DatePickerComponent[] • Default: ['date']The components to display: 'date' and/or 'hourAndMinute'.