diff --git a/src/components/tabs/tab.ts b/src/components/tabs/tab.ts index 884ed7e15..6a64fb9f1 100644 --- a/src/components/tabs/tab.ts +++ b/src/components/tabs/tab.ts @@ -66,7 +66,7 @@ export class CoreTabComponent implements OnInit, OnDestroy { @Output() ionSelect: EventEmitter = new EventEmitter(); @ContentChild(TemplateRef) template: TemplateRef; // Template defined by the content. - @ContentChild(Content) scroll: Content; + @ContentChild(Content) content: Content; element: HTMLElement; // The core-tab element. loaded = false; @@ -122,13 +122,15 @@ export class CoreTabComponent implements OnInit, OnDestroy { // Setup tab scrolling. setTimeout(() => { - // TODO: Solve undefined this.scroll on tab change. + // Workarround to solve undefined this.scroll on tab change. + const scroll: HTMLElement = this.content ? this.content.getScrollElement() : + this.element.querySelector('ion-content > .scroll-content'); - if (this.scroll) { - this.scroll.getScrollElement().onscroll = (e): void => { + if (scroll) { + scroll.onscroll = (e): void => { this.tabs.showHideTabs(e.target); }; - this.tabs.showHideTabs(this.scroll.getScrollElement()); + this.tabs.showHideTabs(scroll); } }, 1); }