From fc37b958fe4fc9f83cace2965f73a81c802cac75 Mon Sep 17 00:00:00 2001 From: Shailesh Lolam Date: Wed, 22 Jul 2020 13:52:18 -0700 Subject: [PATCH] feat(ios): dialog size can now use CSS or attribute like android (#8710) closes https://github.com/NativeScript/NativeScript/issues/8698 --- nativescript-core/ui/core/view/view.ios.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/nativescript-core/ui/core/view/view.ios.ts b/nativescript-core/ui/core/view/view.ios.ts index 327bca8ef..f793592fb 100644 --- a/nativescript-core/ui/core/view/view.ios.ts +++ b/nativescript-core/ui/core/view/view.ios.ts @@ -446,6 +446,21 @@ export class View extends ViewCommon implements ViewDefinition { // set it has prefered content size to the controller presenting the dialog if (options.ios && options.ios.width > 0 && options.ios.height > 0) { controller.preferredContentSize = CGSizeMake(options.ios.width, options.ios.height); + } else { + //use CSS & attribute width & height if option is not provided + let handler = () => { + let w = (this.width || this.style.width); + let h = (this.height || this.style.height); + + //TODO: only numeric value is supported, percentage value is not supported like Android + if (w > 0 && h > 0) { + controller.preferredContentSize = CGSizeMake(w, h); + } + + this.off(View.loadedEvent, handler); + }; + + this.on(View.loadedEvent, handler); } }