fix(ios): stop using artificial state handler via animated setter on uiviewcontroller (#8797)

This commit is contained in:
Nathan Walker
2020-08-27 19:59:30 -07:00
parent 33a703e129
commit 967d652c61
5 changed files with 16 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "nativescript", "name": "nativescript",
"version": "7.0.0-rc.54", "version": "7.0.0-rc.55",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"setup": "npx rimraf -- hooks node_modules package-lock.json && npm i && ts-patch install && nx run core:setup", "setup": "npx rimraf -- hooks node_modules package-lock.json && npm i && ts-patch install && nx run core:setup",

View File

@@ -3,7 +3,7 @@
"main": "index", "main": "index",
"types": "index.d.ts", "types": "index.d.ts",
"description": "NativeScript Core Modules", "description": "NativeScript Core Modules",
"version": "7.0.0-rc.54", "version": "7.0.0-rc.55",
"homepage": "https://nativescript.org", "homepage": "https://nativescript.org",
"repository": { "repository": {
"type": "git", "type": "git",

View File

@@ -29,6 +29,10 @@ export class View extends ViewCommon implements ViewDefinition {
private _popoverPresentationDelegate: IOSHelper.UIPopoverPresentationControllerDelegateImp; private _popoverPresentationDelegate: IOSHelper.UIPopoverPresentationControllerDelegateImp;
private _adaptivePresentationDelegate: IOSHelper.UIAdaptivePresentationControllerDelegateImp; private _adaptivePresentationDelegate: IOSHelper.UIAdaptivePresentationControllerDelegateImp;
/**
* Track modal open animated options to use same option upon close
*/
private _modalAnimatedOptions: Array<boolean>;
private _isLaidOut = false; private _isLaidOut = false;
private _hasTransfrom = false; private _hasTransfrom = false;
private _privateFlags: number = PFLAG_LAYOUT_REQUIRED | PFLAG_FORCE_LAYOUT; private _privateFlags: number = PFLAG_LAYOUT_REQUIRED | PFLAG_FORCE_LAYOUT;
@@ -472,7 +476,7 @@ export class View extends ViewCommon implements ViewDefinition {
this._setupAdaptiveControllerDelegate(controller); this._setupAdaptiveControllerDelegate(controller);
} else { } else {
// Prevent users from dismissing the modal. // Prevent users from dismissing the modal.
(<any>controller).modalInPresentation = true; controller.modalInPresentation = true;
} }
} }
@@ -481,7 +485,12 @@ export class View extends ViewCommon implements ViewDefinition {
this._raiseShowingModallyEvent(); this._raiseShowingModallyEvent();
const animated = options.animated === undefined ? true : !!options.animated; const animated = options.animated === undefined ? true : !!options.animated;
(<any>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); parentController.presentViewControllerAnimatedCompletion(controller, animated, null);
const transitionCoordinator = parentController.transitionCoordinator; const transitionCoordinator = parentController.transitionCoordinator;
if (transitionCoordinator) { if (transitionCoordinator) {
@@ -509,7 +518,7 @@ export class View extends ViewCommon implements ViewDefinition {
} }
const parentController = parent.viewController; const parentController = parent.viewController;
const animated = (<any>this.viewController).animated; const animated = this._modalAnimatedOptions ? !!this._modalAnimatedOptions.pop() : true;
parentController.dismissViewControllerAnimatedCompletion(animated, whenClosedCallback); parentController.dismissViewControllerAnimatedCompletion(animated, whenClosedCallback);
} }

View File

@@ -1,5 +1,5 @@
{ {
"name": "@nativescript/ui-base", "name": "@nativescript/ui-mobile-base",
"version": "7.0.0-rc.0", "version": "7.0.0-rc.0",
"description": "Native UI base components used with NativeScript.", "description": "Native UI base components used with NativeScript.",
"scripts": { "scripts": {

View File

@@ -1,6 +1,6 @@
{ {
"name": "@nativescript/webpack", "name": "@nativescript/webpack",
"version": "3.0.0-rc.0", "version": "3.0.0-rc.1",
"main": "index", "main": "index",
"description": "Webpack plugin for NativeScript", "description": "Webpack plugin for NativeScript",
"homepage": "https://nativescript.org", "homepage": "https://nativescript.org",