Skip to content

Commit 967d652

Browse files
committed
fix(ios): stop using artificial state handler via animated setter on uiviewcontroller (NativeScript#8797)
1 parent 33a703e commit 967d652

File tree

5 files changed

+16
-7
lines changed

5 files changed

+16
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nativescript",
3-
"version": "7.0.0-rc.54",
3+
"version": "7.0.0-rc.55",
44
"license": "MIT",
55
"scripts": {
66
"setup": "npx rimraf -- hooks node_modules package-lock.json && npm i && ts-patch install && nx run core:setup",

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"main": "index",
44
"types": "index.d.ts",
55
"description": "NativeScript Core Modules",
6-
"version": "7.0.0-rc.54",
6+
"version": "7.0.0-rc.55",
77
"homepage": "https://nativescript.org",
88
"repository": {
99
"type": "git",

packages/core/ui/core/view/index.ios.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ export class View extends ViewCommon implements ViewDefinition {
2929
private _popoverPresentationDelegate: IOSHelper.UIPopoverPresentationControllerDelegateImp;
3030
private _adaptivePresentationDelegate: IOSHelper.UIAdaptivePresentationControllerDelegateImp;
3131

32+
/**
33+
* Track modal open animated options to use same option upon close
34+
*/
35+
private _modalAnimatedOptions: Array<boolean>;
3236
private _isLaidOut = false;
3337
private _hasTransfrom = false;
3438
private _privateFlags: number = PFLAG_LAYOUT_REQUIRED | PFLAG_FORCE_LAYOUT;
@@ -472,7 +476,7 @@ export class View extends ViewCommon implements ViewDefinition {
472476
this._setupAdaptiveControllerDelegate(controller);
473477
} else {
474478
// Prevent users from dismissing the modal.
475-
(<any>controller).modalInPresentation = true;
479+
controller.modalInPresentation = true;
476480
}
477481
}
478482

@@ -481,7 +485,12 @@ export class View extends ViewCommon implements ViewDefinition {
481485

482486
this._raiseShowingModallyEvent();
483487
const animated = options.animated === undefined ? true : !!options.animated;
484-
(<any>controller).animated = animated;
488+
if (!this._modalAnimatedOptions) {
489+
// track the user's animated options to use upon close as well
490+
this._modalAnimatedOptions = [];
491+
}
492+
this._modalAnimatedOptions.push(animated);
493+
485494
parentController.presentViewControllerAnimatedCompletion(controller, animated, null);
486495
const transitionCoordinator = parentController.transitionCoordinator;
487496
if (transitionCoordinator) {
@@ -509,7 +518,7 @@ export class View extends ViewCommon implements ViewDefinition {
509518
}
510519

511520
const parentController = parent.viewController;
512-
const animated = (<any>this.viewController).animated;
521+
const animated = this._modalAnimatedOptions ? !!this._modalAnimatedOptions.pop() : true;
513522

514523
parentController.dismissViewControllerAnimatedCompletion(animated, whenClosedCallback);
515524
}

packages/ui-mobile-base/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@nativescript/ui-base",
2+
"name": "@nativescript/ui-mobile-base",
33
"version": "7.0.0-rc.0",
44
"description": "Native UI base components used with NativeScript.",
55
"scripts": {

packages/webpack/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nativescript/webpack",
3-
"version": "3.0.0-rc.0",
3+
"version": "3.0.0-rc.1",
44
"main": "index",
55
"description": "Webpack plugin for NativeScript",
66
"homepage": "https://nativescript.org",

0 commit comments

Comments
 (0)