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