Ionic 4 Hide Toolbar on scroll

I’m trying to implement a directive to hide the Toolbar while scrolling. I tried using this tutorial:

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) {
        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;


ev.domWrite is not a function

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

Any suggestions?

Anyone? I’m stuck with this…

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

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