This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
选择器
具有菜单和滚轮外观的单选输入。
Picker 是单选输入控件。你可以使用 <Picker.Item label value /> 子项来声明选项,以便父级 Picker 读取这些选项,并渲染符合平台特性的下拉菜单或转轮选择器。
通用 Picker 独立于 @expo/ui/community/picker,后者仍然是 @react-native-picker/picker 的兼容垫片。除非你明确需要 RN-Picker API,否则新代码应优先使用此通用 Picker


安装
If you are installing this in an existing React Native app, make sure to install expo in your project.
用法
菜单外观(默认)
转轮外观
appearance="wheel" 会在 iOS 上渲染内联可滚动转轮。在 Android 和 web 上,这会回退为平台的默认下拉菜单(Material 3 没有提供转轮样式的选择器)。
API
import { Picker } from '@expo/ui';
Component
Type: React.Element<PickerProps<T>>
A single-selection input.
Declare options via <Picker.Item label value /> children.
Props for the Picker component, a single-selection input.
PickerAppearance • Default: 'menu'Visual appearance of the picker.
See PickerAppearance.
ReactNode<Picker.Item> children that declare the available options.
TThe currently selected value.
Must match the value of one of the <Picker.Item> children.
Interfaces
Types
Literal type: string
Visual appearance of the picker.
'menu'— Compact button that opens a popup/dropdown on tap. Cross-platform default.'wheel'— Scrollable rotor UI that's always visible inline. iOS only; on Android and web this falls back to the platform's default dropdown.
Acceptable values are: 'wheel' | 'menu'
Literal type: union
The type of values a Picker.Item can carry.
Acceptable values are: string | number