From d138ac000df2e2dfc890db992c39a4429e6ed8dc Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Tue, 3 Jan 2023 15:01:21 -0800 Subject: [PATCH] fix(ios): prevent transitionCoordinator usage during modal presentation (#10153) closes https://github.com/NativeScript/NativeScript/issues/10115 --- packages/core/ui/frame/index.ios.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/core/ui/frame/index.ios.ts b/packages/core/ui/frame/index.ios.ts index 547ed22c4..60a42befd 100644 --- a/packages/core/ui/frame/index.ios.ts +++ b/packages/core/ui/frame/index.ios.ts @@ -118,7 +118,9 @@ export class Frame extends FrameBase { if (!this._currentEntry) { // Update action-bar with disabled animations before the initial navigation. this._updateActionBar(backstackEntry.resolvedPage, true); - this.pushViewControllerAnimated(viewController, animated); + // Core defaults modalPresentationStyle to 1 for standard frame navigation + // for all others, it's modal presentation + this.pushViewControllerAnimated(viewController, animated, this._ios?.controller?.modalPresentationStyle !== 1); if (Trace.isEnabled()) { Trace.write(`${this}.pushViewControllerAnimated(${viewController}, ${animated}); depth = ${navDepth}`, Trace.categories.Navigation); } @@ -180,13 +182,14 @@ export class Frame extends FrameBase { } } - private pushViewControllerAnimated(viewController: UIViewController, animated: boolean) { + private pushViewControllerAnimated(viewController: UIViewController, animated: boolean, isModal: boolean) { let transitionCoordinator = this._ios.controller.transitionCoordinator; - if (transitionCoordinator) { + if (!isModal && transitionCoordinator) { transitionCoordinator.animateAlongsideTransitionCompletion(null, () => { this._ios.controller.pushViewControllerAnimated(viewController, animated); }); } else { + // modal should always push immediately without transition coordinator this._ios.controller.pushViewControllerAnimated(viewController, animated); } }