From 14a66afecab852639b0424ab62f42df94fd3d00d Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Fri, 4 Mar 2022 14:22:58 +0000 Subject: [PATCH] fix(datetime): time picker now scrolls to correct value --- .../picker-column-internal/picker-column-internal.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/components/picker-column-internal/picker-column-internal.tsx b/core/src/components/picker-column-internal/picker-column-internal.tsx index f870f6c0c03..1747fc13021 100644 --- a/core/src/components/picker-column-internal/picker-column-internal.tsx +++ b/core/src/components/picker-column-internal/picker-column-internal.tsx @@ -91,6 +91,7 @@ export class PickerColumnInternal implements ComponentInterface { const ev = entries[0]; if (ev.isIntersecting) { + this.isColumnVisible = true; /** * Because this initial call to scrollActiveItemIntoView has to fire before * 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.initializeScrollListener(); - this.isColumnVisible = true; } else { + this.isColumnVisible = false; + if (this.destroyScrollListener) { this.destroyScrollListener(); this.destroyScrollListener = undefined; } - this.isColumnVisible = false; } } new IntersectionObserver(visibleCallback, { threshold: 0.01 }).observe(this.el);