mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-23 14:01:20 +08:00
fix(app-root): async disable-scroll is cancelled properly
references #9367
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user