fix(all): component reusage (#18963)

Use new stencil APIs to allow ionic elements to be reused once removed from the DOM.

fixes #18843
fixes #17344
fixes #16453
fixes #15879
fixes #15788
fixes #15484
fixes #17890
fixes #16364
This commit is contained in:
Manu MA
2019-08-27 16:29:37 +02:00
committed by GitHub
parent a65d897214
commit 48a27636c7
33 changed files with 411 additions and 368 deletions

View File

@ -76,11 +76,13 @@ export class InfiniteScroll implements ComponentInterface {
*/
@Event() ionInfinite!: EventEmitter<void>;
async componentDidLoad() {
async connectedCallback() {
const contentEl = this.el.closest('ion-content');
if (contentEl) {
this.scrollEl = await contentEl.getScrollElement();
if (!contentEl) {
console.error('<ion-infinite-scroll> must be used inside an <ion-content>');
return;
}
this.scrollEl = await contentEl.getScrollElement();
this.thresholdChanged();
this.disabledChanged();
if (this.position === 'top') {
@ -92,7 +94,7 @@ export class InfiniteScroll implements ComponentInterface {
}
}
componentDidUnload() {
disconnectedCallback() {
this.enableScrollEvents(false);
this.scrollEl = undefined;
}