Fix: ListPicker selected index coercing

This commit is contained in:
vakrilov
2017-03-21 16:31:38 +02:00
parent 8e6b510566
commit ef7d9155b2
3 changed files with 6 additions and 1 deletions

View File

@@ -46,7 +46,6 @@ export const itemsProperty = new Property<ListPickerBase, any[] | ItemsSource>({
name: "items", valueChanged: (target, oldValue, newValue) => {
let getItem = newValue && (<ItemsSource>newValue).getItem;
target.isItemsSource = typeof getItem === "function";
selectedIndexProperty.coerce(target);
}
});
itemsProperty.register(ListPickerBase);

View File

@@ -137,6 +137,9 @@ export class ListPicker extends ListPickerBase {
let maxValue = value && value.length > 0 ? value.length - 1 : 0;
this.android.setMaxValue(maxValue);
this._fixNumberPickerRendering();
// Coerce selected index after we have set items to native view.
selectedIndexProperty.coerce(this);
}
get [colorProperty.native](): { wheelColor: number, textColor: number } {

View File

@@ -46,6 +46,9 @@ export class ListPicker extends ListPickerBase {
}
set [itemsProperty.native](value: any[] | ItemsSource) {
this.ios.reloadAllComponents();
// Coerce selected index after we have set items to native view.
selectedIndexProperty.coerce(this);
}
get [backgroundColorProperty.native](): UIColor {