From 8edb25698898cff58c3759bff853aac0a7ad193e Mon Sep 17 00:00:00 2001 From: Albert Gasset Date: Tue, 6 Aug 2019 12:27:56 +0200 Subject: [PATCH] MOBILE-3042: Fix video menus after refresh --- src/app/app.module.ts | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/app/app.module.ts b/src/app/app.module.ts index cf1f5aceb..c843dce54 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -15,7 +15,7 @@ import { BrowserModule } from '@angular/platform-browser'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { NgModule, COMPILER_OPTIONS } from '@angular/core'; -import { IonicApp, IonicModule, Platform, Content, ScrollEvent, Config } from 'ionic-angular'; +import { IonicApp, IonicModule, Platform, Content, ScrollEvent, Config, Refresher } from 'ionic-angular'; import { assert } from 'ionic-angular/util/util'; import { HttpModule } from '@angular/http'; import { HttpClient, HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http'; @@ -373,6 +373,9 @@ export class AppModule { // Decorate ion-content. this.decorateIonContent(); + + // Patch ion-refresher. + this.patchIonRefresher(); } /** @@ -582,4 +585,24 @@ export class AppModule { this._orientationObs && this._orientationObs.off(); }; } + + /** + * Patch ion-refresher to fix video menus and possibly other fixed positioned elements. + */ + patchIonRefresher(): void { + /** + * Original code: https://github.com/ionic-team/ionic/blob/v3.9.3/src/components/refresher/refresher.ts#L468 + * Changed: translateZ(0px) is not added to the CSS transform. + */ + Refresher.prototype._setCss = function(y: number, duration: string, overflowVisible: boolean, delay: string): void { + this._appliedStyles = (y > 0); + + const content = this._content; + const Css = this._plt.Css; + content.setScrollElementStyle(Css.transform, ((y > 0) ? 'translateY(' + y + 'px)' : '')); + content.setScrollElementStyle(Css.transitionDuration, duration); + content.setScrollElementStyle(Css.transitionDelay, delay); + content.setScrollElementStyle('overflow', (overflowVisible ? 'hidden' : '')); + }; + } }