fix(refresher): set overflow styles when using custom scroll target (#27058)

* bug(refresher): set overflow styles when using custom scroll target

* bug(refresher): set overflow styles when using custom scroll target

* Apply suggestions from code review

Co-authored-by: Liam DeBeasi <liamdebeasi@users.noreply.github.com>

* Add comment

---------

Co-authored-by: Liam DeBeasi <liamdebeasi@users.noreply.github.com>
This commit is contained in:
Shawn Taylor
2023-04-04 12:04:50 -04:00
committed by GitHub
parent 5e35bfc955
commit adbb50ca5b

View File

@ -354,7 +354,10 @@ export class Refresher implements ComponentInterface {
this.state = RefresherState.Pulling;
writeTask(() => this.scrollEl!.style.setProperty('--overflow', 'hidden'));
// When ion-refresher is being used with a custom scroll target, the overflow styles need to be applied directly instead of via a css variable
const { scrollEl } = this;
const overflowProperty = scrollEl!.matches(ION_CONTENT_CLASS_SELECTOR) ? 'overflow' : '--overflow';
writeTask(() => scrollEl!.style.setProperty(overflowProperty, 'hidden'));
const animationType = getRefresherAnimationType(contentEl);
const animation = createPullingAnimation(animationType, pullingRefresherIcon, this.el);
@ -378,7 +381,10 @@ export class Refresher implements ComponentInterface {
this.gesture!.enable(false);
writeTask(() => this.scrollEl!.style.removeProperty('--overflow'));
const { scrollEl } = this;
const overflowProperty = scrollEl!.matches(ION_CONTENT_CLASS_SELECTOR) ? 'overflow' : '--overflow';
writeTask(() => scrollEl!.style.removeProperty(overflowProperty));
if (this.progress <= 0.4) {
ev.data.animation.progressEnd(0, this.progress, 500).onFinish(() => {
this.animations.forEach((ani) => ani.destroy());