ListPicker
<listPicker>
is a UI component that lets the user select a value from a pre-configured list.
See also:
import * as React from "react";
import { EventData, ListPicker } from "@nativescript/core";
<listPicker
items={listOfItems}
selectedIndex={0}
onSelectedIndexChange={(args: EventData) => {
const listPicker: ListPicker = args.object as ListPicker;
const index: number = listPicker.selectedIndex;
const item = listPicker.items[index];
}}
/>
Props
Name | Type | Description |
---|---|---|
items | Array<string> | Gets or sets the items displayed as options in the list picker. |
selectedIndex | number | Gets or sets the index of the currently selected item. |
onSelectedIndexChange | (args: EventData ) => void | Emitted when the selected time changes. The new index can be retrieved via args.object.selectedIndex . |
Native component
Android | iOS |
---|---|
android.widget.NumberPicker | UIPickerView |