mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-21 04:53:58 +08:00
feat(content, reorder-group, header, footer, infinite-scroll, refresher): add custom scroll target to improve compatibility with virtual scroll (#24883)
Resolves #23437
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import { Component, ComponentInterface, Element, Event, EventEmitter, Host, Method, Prop, State, Watch, h, readTask, writeTask } from '@stencil/core';
|
||||
import { findClosestIonContent, getScrollElement, printIonContentErrorMsg } from '@utils/content';
|
||||
|
||||
import { getIonMode } from '../../global/ionic-global';
|
||||
import { componentOnReady } from '../../utils/helpers';
|
||||
|
||||
@Component({
|
||||
tag: 'ion-infinite-scroll',
|
||||
@ -78,13 +78,12 @@ export class InfiniteScroll implements ComponentInterface {
|
||||
@Event() ionInfinite!: EventEmitter<void>;
|
||||
|
||||
async connectedCallback() {
|
||||
const contentEl = this.el.closest('ion-content');
|
||||
const contentEl = findClosestIonContent(this.el);
|
||||
if (!contentEl) {
|
||||
console.error('<ion-infinite-scroll> must be used inside an <ion-content>');
|
||||
printIonContentErrorMsg(this.el);
|
||||
return;
|
||||
}
|
||||
await new Promise(resolve => componentOnReady(contentEl, resolve));
|
||||
this.scrollEl = await contentEl.getScrollElement();
|
||||
this.scrollEl = await getScrollElement(contentEl);
|
||||
this.thresholdChanged();
|
||||
this.disabledChanged();
|
||||
if (this.position === 'top') {
|
||||
|
Reference in New Issue
Block a user