mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
18 lines
606 B
TypeScript
18 lines
606 B
TypeScript
import * as listPickerModule from "tns-core-modules/ui/list-picker";
|
|
|
|
export function getNativeItemsCount(listPicker: listPickerModule.ListPicker): number {
|
|
var maxValue = listPicker.android.getMaxValue();
|
|
|
|
if (listPicker.items.length === 0 && maxValue === 0) {
|
|
return 0;
|
|
}
|
|
|
|
return maxValue + 1;
|
|
}
|
|
|
|
export function selectNativeItem(listPicker: listPickerModule.ListPicker, index: number): void {
|
|
var oldIndex = listPicker.selectedIndex;
|
|
listPicker.android.setValue(index);
|
|
(<any>listPicker)._valueChangedListener.onValueChange(listPicker.android, oldIndex, index);
|
|
}
|