fix(ios): prevent transitionCoordinator usage during modal presentation (#10153)

closes https://github.com/NativeScript/NativeScript/issues/10115
This commit is contained in:
Nathan Walker
2023-01-03 15:01:21 -08:00
committed by GitHub
parent 760bbd06fa
commit d138ac000d

View File

@ -118,7 +118,9 @@ export class Frame extends FrameBase {
if (!this._currentEntry) { if (!this._currentEntry) {
// Update action-bar with disabled animations before the initial navigation. // Update action-bar with disabled animations before the initial navigation.
this._updateActionBar(backstackEntry.resolvedPage, true); 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()) { if (Trace.isEnabled()) {
Trace.write(`${this}.pushViewControllerAnimated(${viewController}, ${animated}); depth = ${navDepth}`, Trace.categories.Navigation); 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; let transitionCoordinator = this._ios.controller.transitionCoordinator;
if (transitionCoordinator) { if (!isModal && transitionCoordinator) {
transitionCoordinator.animateAlongsideTransitionCompletion(null, () => { transitionCoordinator.animateAlongsideTransitionCompletion(null, () => {
this._ios.controller.pushViewControllerAnimated(viewController, animated); this._ios.controller.pushViewControllerAnimated(viewController, animated);
}); });
} else { } else {
// modal should always push immediately without transition coordinator
this._ios.controller.pushViewControllerAnimated(viewController, animated); this._ios.controller.pushViewControllerAnimated(viewController, animated);
} }
} }