mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-18 22:01:42 +08:00
feat: closingModally event
This commit is contained in:
@ -713,6 +713,7 @@ export class View extends ViewCommon {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected _hideNativeModalView(parent: View, whenClosedCallback: () => void) {
|
protected _hideNativeModalView(parent: View, whenClosedCallback: () => void) {
|
||||||
|
this._raiseClosingModallyEvent();
|
||||||
const manager = this._dialogFragment.getFragmentManager();
|
const manager = this._dialogFragment.getFragmentManager();
|
||||||
if (manager) {
|
if (manager) {
|
||||||
this._dialogFragment.dismissAllowingStateLoss();
|
this._dialogFragment.dismissAllowingStateLoss();
|
||||||
|
@ -543,6 +543,7 @@ export class View extends ViewCommon implements ViewDefinition {
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this._raiseClosingModallyEvent();
|
||||||
|
|
||||||
// modal view has already been closed by UI, probably as a popover
|
// modal view has already been closed by UI, probably as a popover
|
||||||
if (!parent.viewController.presentedViewController) {
|
if (!parent.viewController.presentedViewController) {
|
||||||
|
@ -71,6 +71,7 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
|
|||||||
public static layoutChangedEvent = 'layoutChanged';
|
public static layoutChangedEvent = 'layoutChanged';
|
||||||
public static shownModallyEvent = 'shownModally';
|
public static shownModallyEvent = 'shownModally';
|
||||||
public static showingModallyEvent = 'showingModally';
|
public static showingModallyEvent = 'showingModally';
|
||||||
|
public static closingModallyEvent = 'closingModally';
|
||||||
public static accessibilityBlurEvent = accessibilityBlurEvent;
|
public static accessibilityBlurEvent = accessibilityBlurEvent;
|
||||||
public static accessibilityFocusEvent = accessibilityFocusEvent;
|
public static accessibilityFocusEvent = accessibilityFocusEvent;
|
||||||
public static accessibilityFocusChangedEvent = accessibilityFocusChangedEvent;
|
public static accessibilityFocusChangedEvent = accessibilityFocusChangedEvent;
|
||||||
@ -434,6 +435,13 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
|
|||||||
};
|
};
|
||||||
this.notify(args);
|
this.notify(args);
|
||||||
}
|
}
|
||||||
|
protected _raiseClosingModallyEvent() {
|
||||||
|
const args: EventData = {
|
||||||
|
eventName: ViewCommon.closingModallyEvent,
|
||||||
|
object: this,
|
||||||
|
};
|
||||||
|
this.notify(args);
|
||||||
|
}
|
||||||
|
|
||||||
private _isEvent(name: string): boolean {
|
private _isEvent(name: string): boolean {
|
||||||
return this.constructor && `${name}Event` in this.constructor;
|
return this.constructor && `${name}Event` in this.constructor;
|
||||||
|
Reference in New Issue
Block a user