This is documentation for the next SDK version. For up-to-date documentation, see the latest version (SDK 54).
A Jetpack Compose Picker component for selecting options from a list.
A picker component that allows users to select from a list of options with different display styles.
Installation
- npx expo install @expo/uiIf you are installing this in an existing React Native app, make sure to install expo in your project.
Radio picker
import { Picker } from '@expo/ui/jetpack-compose'; <Picker options={['$', '$$', '$$$', '$$$$']} selectedIndex={selectedIndex} onOptionSelected={({ nativeEvent: { index } }) => { setSelectedIndex(index); }} variant="radio" />
See official Jetpack Compose documentation for more information.
Segmented picker
import { Picker } from '@expo/ui/jetpack-compose'; <Picker options={['$', '$$', '$$$', '$$$$']} selectedIndex={selectedIndex} onOptionSelected={({ nativeEvent: { index } }) => { setSelectedIndex(index); }} variant="segmented" />
See official Jetpack Compose documentation for more information.
API
Component
Type: React.Element<PickerProps>
Displays a native picker component. Depending on the variant it can be a segmented button, an inline picker, a list of choices or a radio button.
(event: {
nativeEvent: {
index: number,
label: string
}
}) => voidCallback function that is called when an option is selected.
unionThe index of the currently selected option.
Acceptable values are: number | null
Types
Colors for picker's core elements.
| Property | Type | Description |
|---|---|---|
| activeBorderColor(optional) | string | - |
| activeContainerColor(optional) | string | - |
| activeContentColor(optional) | string | - |
| disabledActiveBorderColor(optional) | string | - |
| disabledActiveContainerColor(optional) | string | - |
| disabledActiveContentColor(optional) | string | - |
| disabledInactiveBorderColor(optional) | string | - |
| disabledInactiveContainerColor(optional) | string | - |
| disabledInactiveContentColor(optional) | string | - |
| inactiveBorderColor(optional) | string | - |
| inactiveContainerColor(optional) | string | - |
| inactiveContentColor(optional) | string | - |