From 177a089e91cba704d95de2d015f193fa732041b2 Mon Sep 17 00:00:00 2001 From: "Manu Mtz.-Almeida" Date: Sat, 26 Nov 2016 19:28:57 +0100 Subject: [PATCH] fix(app-root): async disable-scroll is cancelled properly references #9367 --- src/components/app/app-root.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/components/app/app-root.ts b/src/components/app/app-root.ts index f1e462ae00..319bd8806e 100644 --- a/src/components/app/app-root.ts +++ b/src/components/app/app-root.ts @@ -113,14 +113,20 @@ export class IonicApp extends Ion implements OnInit { * @private */ _disableScroll(shouldDisableScroll: boolean) { - console.log('App Root: Scroll Disable Assist', shouldDisableScroll); - if (shouldDisableScroll) { this.stopScroll().then(() => { - this._rafId = nativeTimeout(() => this.setElementClass('disable-scroll', true), 16 * 2); + this._rafId = nativeTimeout(() => { + console.debug('App Root: adding .disable-scroll'); + this.setElementClass('disable-scroll', true); + }, 16 * 2); }); } else { - cancelAnimationFrame(this._rafId); + let plugin = this._stopScrollPlugin; + if (plugin && plugin.cancel) { + plugin.cancel(); + } + clearTimeout(this._rafId); + console.debug('App Root: removing .disable-scroll'); this.setElementClass('disable-scroll', false); } }