Picker
One choice out of a longer list.
Import
import {Picker} from '@hzblj/kara-ui'Props
A single choice from a list — a SwiftUI wheel picker on iOS, Material's exposed dropdown on Android. It brings its own host, so it renders outside Screen and Island as well.
| Prop | Type | Default | Description |
|---|---|---|---|
| options* | PickerOption[] | — | The choices, in order. |
| value* | string | — | The selected option's |
| disabled | boolean | false | Stops the user changing the selection, and dims the picker. |
| onValueChange | (value: string) => void | — | Called with the chosen option's |
| testID | string | — | Android: the dropdown field's test tag. iOS: |
The choices, in order.
The selected option's value. Controlled: pass back what onValueChange reports.
Stops the user changing the selection, and dims the picker.
Called with the chosen option's value.
Android: the dropdown field's test tag. iOS: @expo/ui's wheel picker drops it.
PickerOption
One choice of a Picker.
| Prop | Type | Description |
|---|---|---|
| label* | string | What the user reads. |
| value* | string | What |
What the user reads.
What onValueChange reports. It also keys the option, so it must be unique.
Platform notes
- A wheel on iOS, an exposed dropdown menu on Android.