mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix: column scrolls into view when option is ready
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user