fix: column scrolls into view when option is ready

This commit is contained in:
Liam DeBeasi
2023-12-01 15:16:59 -05:00
parent 75ee951ce8
commit b1fc67227c

View File

@@ -64,6 +64,20 @@ export class PickerColumnOption implements ComponentInterface {
this.ariaLabel = inheritedAttributes['aria-label'] || null;
}
/**
* The column options can load at any time
* so the selected option needs to tell the
* parent picker column when it is loaded
* so the picker column can ensure it is
* centered in the view.
*/
componentDidLoad() {
const parentPickerColumn = this.el.closest('ion-picker-column');
if (parentPickerColumn !== null && this.value === parentPickerColumn.value) {
parentPickerColumn.scrollActiveItemIntoView();
}
}
/**
* When an option is clicked update the
* parent picker column value. This