mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-21 04:53:58 +08:00
fix(datetime): time picker now scrolls to correct value (#24879)
resolves #24878
This commit is contained in:
@ -91,6 +91,7 @@ export class PickerColumnInternal implements ComponentInterface {
|
|||||||
const ev = entries[0];
|
const ev = entries[0];
|
||||||
|
|
||||||
if (ev.isIntersecting) {
|
if (ev.isIntersecting) {
|
||||||
|
this.isColumnVisible = true;
|
||||||
/**
|
/**
|
||||||
* Because this initial call to scrollActiveItemIntoView has to fire before
|
* Because this initial call to scrollActiveItemIntoView has to fire before
|
||||||
* the scroll listener is set up, we need to manage the active class manually.
|
* the scroll listener is set up, we need to manage the active class manually.
|
||||||
@ -101,13 +102,13 @@ export class PickerColumnInternal implements ComponentInterface {
|
|||||||
this.activeItem?.classList.add(PICKER_COL_ACTIVE);
|
this.activeItem?.classList.add(PICKER_COL_ACTIVE);
|
||||||
|
|
||||||
this.initializeScrollListener();
|
this.initializeScrollListener();
|
||||||
this.isColumnVisible = true;
|
|
||||||
} else {
|
} else {
|
||||||
|
this.isColumnVisible = false;
|
||||||
|
|
||||||
if (this.destroyScrollListener) {
|
if (this.destroyScrollListener) {
|
||||||
this.destroyScrollListener();
|
this.destroyScrollListener();
|
||||||
this.destroyScrollListener = undefined;
|
this.destroyScrollListener = undefined;
|
||||||
}
|
}
|
||||||
this.isColumnVisible = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
new IntersectionObserver(visibleCallback, { threshold: 0.01 }).observe(this.el);
|
new IntersectionObserver(visibleCallback, { threshold: 0.01 }).observe(this.el);
|
||||||
|
Reference in New Issue
Block a user