fix(reorder-group): wait for content to render before getting scroll position (#24007)

resolves #23875
This commit is contained in:
Will Martin
2021-10-05 16:15:08 -04:00
committed by GitHub
parent 4715a57010
commit 225a278740

View File

@@ -2,6 +2,7 @@ import { Component, ComponentInterface, Element, Event, EventEmitter, Host, Meth
import { getIonMode } from '../../global/ionic-global';
import { Gesture, GestureDetail, ItemReorderEventDetail } from '../../interface';
import { componentOnReady } from '../../utils/helpers';
import { hapticSelectionChanged, hapticSelectionEnd, hapticSelectionStart } from '../../utils/native/haptic';
const enum ReorderGroupState {
@@ -55,6 +56,7 @@ export class ReorderGroup implements ComponentInterface {
async connectedCallback() {
const contentEl = this.el.closest('ion-content');
if (contentEl) {
await new Promise(resolve => componentOnReady(contentEl, resolve));
this.scrollEl = await contentEl.getScrollElement();
}
this.gesture = (await import('../../utils/gesture')).createGesture({