MOBILE-2937 tabs: Solve hide tabs on dynamic components

main
Pau Ferrer Ocaña 2019-03-25 13:08:44 +01:00
parent 6718d36d6c
commit 3878ea7141
1 changed files with 7 additions and 5 deletions

View File

@ -66,7 +66,7 @@ export class CoreTabComponent implements OnInit, OnDestroy {
@Output() ionSelect: EventEmitter<CoreTabComponent> = new EventEmitter<CoreTabComponent>();
@ContentChild(TemplateRef) template: TemplateRef<any>; // 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);
}