| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 5e744ef commit 1243ef6
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -324,7 +324,11 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition { | |||
| 324 | 324 | } | |
| 325 | 325 | } | |
| 326 | 326 | ||
| 327 | - that._hideNativeModalView(parent, whenClosedCallback); | ||
| 327 | + if (that.viewController) { | ||
| 328 | + that._hideNativeModalView(parent, whenClosedCallback); | ||
| 329 | + } else { | ||
| 330 | + whenClosedCallback(); | ||
| 331 | + } | ||
| 328 | 332 | } | |
| 329 | 333 | }; | |
| 330 | 334 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -417,7 +417,7 @@ export class View extends ViewCommon { | |||
| 417 | 417 | ||
| 418 | 418 | if (presentationStyle === UIModalPresentationStyle.Popover) { | |
| 419 | 419 | const popoverPresentationController = controller.popoverPresentationController; | |
| 420 | - this._popoverPresentationDelegate = ios.UIPopoverPresentationControllerDelegateImp.initWithOwner(new WeakRef(this), options.closeCallback); | ||
| 420 | + this._popoverPresentationDelegate = ios.UIPopoverPresentationControllerDelegateImp.initWithOwnerAndCallback(new WeakRef(this), this._closeModalCallback); | ||
| 421 | 421 | popoverPresentationController.delegate = this._popoverPresentationDelegate; | |
| 422 | 422 | const view = parent.nativeViewProtected; | |
| 423 | 423 | // Note: sourceView and sourceRect are needed to specify the anchor location for the popover. | |
@@ -452,14 +452,15 @@ export class View extends ViewCommon { | |||
| 452 | 452 | return; | |
| 453 | 453 | } | |
| 454 | 454 | ||
| 455 | - if (!this.viewController) { | ||
| 456 | - return; | ||
| 457 | - } | ||
| 458 | - | ||
| 459 | 455 | const parentController = parent.viewController; | |
| 460 | 456 | const animated = (<any>this.viewController).animated; | |
| 461 | 457 | ||
| 462 | 458 | parentController.dismissViewControllerAnimatedCompletion(animated, whenClosedCallback); | |
| 459 | + | ||
| 460 | + // We are manually calling the callback because 'UIModalPresentationStyle.Popover' case | ||
| 461 | + if (this.viewController.popoverPresentationController) { | ||
| 462 | + whenClosedCallback(); | ||
| 463 | + } | ||
| 463 | 464 | } | |
| 464 | 465 | ||
| 465 | 466 | [isEnabledProperty.getDefault](): boolean { | |
@@ -994,21 +995,21 @@ export namespace ios { | |||
| 994 | 995 | public static ObjCProtocols = [UIPopoverPresentationControllerDelegate]; | |
| 995 | 996 | ||
| 996 | 997 | private owner: WeakRef<View>; | |
| 997 | - private whenClosedCallback: Function; | ||
| 998 | + private closedCallback: Function; | ||
| 998 | 999 | ||
| 999 | - public static initWithOwner(owner: WeakRef<View>, whenClosedCallback: Function): UIPopoverPresentationControllerDelegateImp { | ||
| 1000 | + public static initWithOwnerAndCallback(owner: WeakRef<View>, whenClosedCallback: Function): UIPopoverPresentationControllerDelegateImp { | ||
| 1000 | 1001 | const instance = <UIPopoverPresentationControllerDelegateImp>super.new(); | |
| 1001 | 1002 | instance.owner = owner; | |
| 1002 | - instance.whenClosedCallback = whenClosedCallback; | ||
| 1003 | + instance.closedCallback = whenClosedCallback; | ||
| 1003 | 1004 | ||
| 1004 | 1005 | return instance; | |
| 1005 | 1006 | } | |
| 1006 | 1007 | ||
| 1007 | 1008 | public popoverPresentationControllerDidDismissPopover(popoverPresentationController: UIPopoverPresentationController) { | |
| 1008 | 1009 | const owner = this.owner.get(); | |
| 1009 | 1010 | if (owner) { | |
| 1010 | - if (typeof this.whenClosedCallback === "function") { | ||
| 1011 | - this.whenClosedCallback(); | ||
| 1011 | + if (typeof this.closedCallback === "function") { | ||
| 1012 | + this.closedCallback(); | ||
| 1012 | 1013 | } | |
| 1013 | 1014 | } | |
| 1014 | 1015 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments