feat(dialogs): Setting the size of popup dialog thru dialog options (#8041)

* Added iOS specific height and width attributes to ShowModalOptions

* Set the height and width of the popup dialog to the presenting controller

* dialog options ios attributes presentationStyle, height & width are made optional

* Updated NativeScript.api.md for public API changes

* Update with git properties

* Public API

* CLA update
This commit is contained in:
Shailesh Lolam
2019-12-05 05:30:40 -07:00
committed by Alexander Vakrilov
parent 49a7607f4e
commit cd5703a6b7
3 changed files with 20 additions and 5 deletions

View File

@@ -1884,7 +1884,9 @@ export interface ShowModalOptions {
fullscreen?: boolean; fullscreen?: boolean;
ios?: { ios?: {
presentationStyle: any /* UIModalPresentationStyle */ presentationStyle?: any; /* UIModalPresentationStyle */
width?: number;
height?: number;
} }
stretched?: boolean; stretched?: boolean;
@@ -3065,9 +3067,9 @@ export class XmlParser {
// nativescript-core/index.d.ts:117:5 - (ae-forgotten-export) The symbol "layout" needs to be exported by the entry point index.d.ts // nativescript-core/index.d.ts:117:5 - (ae-forgotten-export) The symbol "layout" needs to be exported by the entry point index.d.ts
// nativescript-core/index.d.ts:118:5 - (ae-forgotten-export) The symbol "ad" needs to be exported by the entry point index.d.ts // nativescript-core/index.d.ts:118:5 - (ae-forgotten-export) The symbol "ad" needs to be exported by the entry point index.d.ts
// nativescript-core/index.d.ts:119:5 - (ae-forgotten-export) The symbol "ios" needs to be exported by the entry point index.d.ts // nativescript-core/index.d.ts:119:5 - (ae-forgotten-export) The symbol "ios" needs to be exported by the entry point index.d.ts
// nativescript-core/ui/core/view-base/view-base.d.ts:171:26 - (ae-forgotten-export) The symbol "Property" needs to be exported by the entry point index.d.ts // nativescript-core/ui/core/view-base/view-base.d.ts:179:26 - (ae-forgotten-export) The symbol "Property" needs to be exported by the entry point index.d.ts
// nativescript-core/ui/core/view-base/view-base.d.ts:171:26 - (ae-forgotten-export) The symbol "CssProperty" needs to be exported by the entry point index.d.ts // nativescript-core/ui/core/view-base/view-base.d.ts:179:26 - (ae-forgotten-export) The symbol "CssProperty" needs to be exported by the entry point index.d.ts
// nativescript-core/ui/core/view-base/view-base.d.ts:171:26 - (ae-forgotten-export) The symbol "CssAnimationProperty" needs to be exported by the entry point index.d.ts // nativescript-core/ui/core/view-base/view-base.d.ts:179:26 - (ae-forgotten-export) The symbol "CssAnimationProperty" needs to be exported by the entry point index.d.ts
// (No @packageDocumentation comment for this package) // (No @packageDocumentation comment for this package)

View File

@@ -79,7 +79,15 @@ export interface ShowModalOptions {
/** /**
* The UIModalPresentationStyle to be used when showing the dialog in iOS . * The UIModalPresentationStyle to be used when showing the dialog in iOS .
*/ */
presentationStyle: any /* UIModalPresentationStyle */ presentationStyle?: any; /* UIModalPresentationStyle */
/**
* width of the popup dialog
*/
width?: number;
/**
* height of the popup dialog
*/
height?: number;
} }
android?: { android?: {
/** /**

View File

@@ -432,6 +432,11 @@ export class View extends ViewCommon implements ViewDefinition {
controller.modalPresentationStyle = UIModalPresentationStyle.FullScreen; controller.modalPresentationStyle = UIModalPresentationStyle.FullScreen;
} else { } else {
controller.modalPresentationStyle = UIModalPresentationStyle.FormSheet; controller.modalPresentationStyle = UIModalPresentationStyle.FormSheet;
//check whether both height and width is provided and are positive numbers
// 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);
}
} }
if (options.ios && options.ios.presentationStyle) { if (options.ios && options.ios.presentationStyle) {