feat(ios): dialog size can now use CSS or attribute like android (#8710)

closes https://github.com/NativeScript/NativeScript/issues/8698
This commit is contained in:
Shailesh Lolam
2020-07-22 13:52:18 -07:00
committed by GitHub
parent 08502527eb
commit fc37b958fe

View File

@ -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 = <number>(this.width || this.style.width);
let h = <number>(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);
}
}