From 967d652c61fbeed6c7e8bd568c893d40308b5b58 Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Thu, 27 Aug 2020 19:59:30 -0700 Subject: [PATCH] fix(ios): stop using artificial state handler via animated setter on uiviewcontroller (#8797) --- package.json | 2 +- packages/core/package.json | 2 +- packages/core/ui/core/view/index.ios.ts | 15 ++++++++++++--- packages/ui-mobile-base/package.json | 2 +- packages/webpack/package.json | 2 +- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 714560ba2..62c1e0ca6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nativescript", - "version": "7.0.0-rc.54", + "version": "7.0.0-rc.55", "license": "MIT", "scripts": { "setup": "npx rimraf -- hooks node_modules package-lock.json && npm i && ts-patch install && nx run core:setup", diff --git a/packages/core/package.json b/packages/core/package.json index 0859f4b93..df37c4229 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -3,7 +3,7 @@ "main": "index", "types": "index.d.ts", "description": "NativeScript Core Modules", - "version": "7.0.0-rc.54", + "version": "7.0.0-rc.55", "homepage": "https://nativescript.org", "repository": { "type": "git", diff --git a/packages/core/ui/core/view/index.ios.ts b/packages/core/ui/core/view/index.ios.ts index c02b833ba..cdb4a1364 100644 --- a/packages/core/ui/core/view/index.ios.ts +++ b/packages/core/ui/core/view/index.ios.ts @@ -29,6 +29,10 @@ export class View extends ViewCommon implements ViewDefinition { private _popoverPresentationDelegate: IOSHelper.UIPopoverPresentationControllerDelegateImp; private _adaptivePresentationDelegate: IOSHelper.UIAdaptivePresentationControllerDelegateImp; + /** + * Track modal open animated options to use same option upon close + */ + private _modalAnimatedOptions: Array; private _isLaidOut = false; private _hasTransfrom = false; private _privateFlags: number = PFLAG_LAYOUT_REQUIRED | PFLAG_FORCE_LAYOUT; @@ -472,7 +476,7 @@ export class View extends ViewCommon implements ViewDefinition { this._setupAdaptiveControllerDelegate(controller); } else { // Prevent users from dismissing the modal. - (controller).modalInPresentation = true; + controller.modalInPresentation = true; } } @@ -481,7 +485,12 @@ export class View extends ViewCommon implements ViewDefinition { this._raiseShowingModallyEvent(); const animated = options.animated === undefined ? true : !!options.animated; - (controller).animated = animated; + if (!this._modalAnimatedOptions) { + // track the user's animated options to use upon close as well + this._modalAnimatedOptions = []; + } + this._modalAnimatedOptions.push(animated); + parentController.presentViewControllerAnimatedCompletion(controller, animated, null); const transitionCoordinator = parentController.transitionCoordinator; if (transitionCoordinator) { @@ -509,7 +518,7 @@ export class View extends ViewCommon implements ViewDefinition { } const parentController = parent.viewController; - const animated = (this.viewController).animated; + const animated = this._modalAnimatedOptions ? !!this._modalAnimatedOptions.pop() : true; parentController.dismissViewControllerAnimatedCompletion(animated, whenClosedCallback); } diff --git a/packages/ui-mobile-base/package.json b/packages/ui-mobile-base/package.json index f165deab8..89820b440 100644 --- a/packages/ui-mobile-base/package.json +++ b/packages/ui-mobile-base/package.json @@ -1,5 +1,5 @@ { - "name": "@nativescript/ui-base", + "name": "@nativescript/ui-mobile-base", "version": "7.0.0-rc.0", "description": "Native UI base components used with NativeScript.", "scripts": { diff --git a/packages/webpack/package.json b/packages/webpack/package.json index 665ce99a2..255e1362b 100644 --- a/packages/webpack/package.json +++ b/packages/webpack/package.json @@ -1,6 +1,6 @@ { "name": "@nativescript/webpack", - "version": "3.0.0-rc.0", + "version": "3.0.0-rc.1", "main": "index", "description": "Webpack plugin for NativeScript", "homepage": "https://nativescript.org",