diff --git a/core/src/components/refresher/refresher.tsx b/core/src/components/refresher/refresher.tsx index 643456f3f13..99899092530 100644 --- a/core/src/components/refresher/refresher.tsx +++ b/core/src/components/refresher/refresher.tsx @@ -165,7 +165,7 @@ export class Refresher implements ComponentInterface { private async setupiOSNativeRefresher(pullingSpinner: HTMLIonSpinnerElement, refreshingSpinner: HTMLIonSpinnerElement) { this.elementToTransform = this.scrollEl!; const ticks = pullingSpinner.shadowRoot!.querySelectorAll('svg'); - const MAX_PULL = this.scrollEl!.clientHeight * 0.16; + let MAX_PULL = this.scrollEl!.clientHeight * 0.16; const NUM_TICKS = ticks.length; writeTask(() => ticks.forEach(el => el.style.setProperty('animation', 'none'))); @@ -251,6 +251,18 @@ export class Refresher implements ComponentInterface { if (!this.didRefresh) { translateElement(this.elementToTransform, '0px'); } + + /** + * If the content had `display: none` when + * the refresher was initialized, its clientHeight + * will be 0. When the gesture starts, the content + * will be visible, so try to get the correct + * client height again. This is most common when + * using the refresher in an ion-menu. + */ + if (MAX_PULL === 0) { + MAX_PULL = this.scrollEl!.clientHeight * 0.16; + } }, onMove: ev => { this.lastVelocityY = ev.velocityY;