Ionic 3 scroll events sometimes not triggered on android and desktop browser

I am using this directive to hide the header and toolbar when scroll down:

It’s simple and works perfectly on ios but not so well on android and desktop browser:

I’ve tried to fix it but due to my limited knowledge and skills I couldn’t. Any help would be much appreciated.