Ionic 4 Hide Toolbar on scroll

#1

I’m trying to implement a directive to hide the Toolbar while scrolling. I tried using this tutorial: https://medium.com/@gregor.srdic/ionic3-hidding-header-on-footer-on-content-scroll-15ab95b05dc5

This worked with Ionic 3, but doesn’t work with Ionic 4.
On the following code I get the error:

private adjustElementOnScroll(ev) {
    if (ev) {
        console.log(ev);
        ev.domWrite(() => {
            let scrollTop: number = ev.scrollTop > 0 ? ev.scrollTop : 0;
            let scrolldiff: number = scrollTop - this.lastScrollPosition;
            this.lastScrollPosition = scrollTop;
            let newValue = this.lastValue + scrolldiff;
            newValue = Math.max(0, Math.min(newValue, this.config.maxValue));
            this.renderer.setStyle(this.element.nativeElement, this.config.cssProperty, `-${newValue}px`);
            this.lastValue = newValue;
        });
    }
}

Error:

ev.domWrite is not a function

I checked, and ev in Ionic 4 is a CustomEvent , not a ScrollEvent .

Any suggestions?

#2

Anyone? I’m stuck with this…

#3

i am too have problems implement
this directive if any one can help with any solution for that
any solution that work for hiding header while scrolling

#4

Hi.
I asked the question here:
Ionic 4 Hide Toolbar on scroll
Report which solution works for you in the latest Ionic 4 release