mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
fix(gestures): gesture controller handled by components
* fix(gestures): gesture controller is handled by components fixes #9046 * fix(gestures): adds hybrid disable scroll assistance fixes #9130 fixes #9052 fixes #7444
This commit is contained in:

committed by
Adam Bradley

parent
339857af1e
commit
32ab817181
@ -5,7 +5,8 @@ import { Form } from '../../util/form';
|
||||
import { Key } from '../../util/key';
|
||||
import { NavParams } from '../../navigation/nav-params';
|
||||
import { ViewController } from '../../navigation/view-controller';
|
||||
|
||||
import { BlockerDelegate, GestureController, BLOCK_ALL } from '../../gestures/gesture-controller';
|
||||
import { assert } from '../../util/util';
|
||||
|
||||
/**
|
||||
* @private
|
||||
@ -53,15 +54,18 @@ export class ActionSheetCmp {
|
||||
hdrId: string;
|
||||
id: number;
|
||||
mode: string;
|
||||
gestureBlocker: BlockerDelegate;
|
||||
|
||||
constructor(
|
||||
private _viewCtrl: ViewController,
|
||||
private _config: Config,
|
||||
private _elementRef: ElementRef,
|
||||
private _form: Form,
|
||||
gestureCtrl: GestureController,
|
||||
params: NavParams,
|
||||
renderer: Renderer
|
||||
) {
|
||||
this.gestureBlocker = gestureCtrl.createBlocker(BLOCK_ALL);
|
||||
this.d = params.data;
|
||||
this.mode = _config.get('mode');
|
||||
renderer.setElementClass(_elementRef.nativeElement, `action-sheet-${this.mode}`, true);
|
||||
@ -110,6 +114,14 @@ export class ActionSheetCmp {
|
||||
this.d.buttons = buttons;
|
||||
}
|
||||
|
||||
ionViewWillEnter() {
|
||||
this.gestureBlocker.block();
|
||||
}
|
||||
|
||||
ionViewDidLeave() {
|
||||
this.gestureBlocker.unblock();
|
||||
}
|
||||
|
||||
ionViewDidEnter() {
|
||||
this._form.focusOut();
|
||||
|
||||
@ -166,6 +178,11 @@ export class ActionSheetCmp {
|
||||
dismiss(role: any): Promise<any> {
|
||||
return this._viewCtrl.dismiss(null, role);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
assert(this.gestureBlocker.blocked === false, 'gesture blocker must be already unblocked');
|
||||
this.gestureBlocker.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
let actionSheetIds = -1;
|
||||
|
Reference in New Issue
Block a user