Skip to content

Commit cd5703a

Browse files
slolamAlexander Vakrilov
authored andcommitted
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
1 parent 49a7607 commit cd5703a

3 files changed

Lines changed: 20 additions & 5 deletions

File tree

api-reports/NativeScript.api.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1884,7 +1884,9 @@ export interface ShowModalOptions {
18841884
fullscreen?: boolean;
18851885

18861886
ios?: {
1887-
presentationStyle: any /* UIModalPresentationStyle */
1887+
presentationStyle?: any; /* UIModalPresentationStyle */
1888+
width?: number;
1889+
height?: number;
18881890
}
18891891

18901892
stretched?: boolean;
@@ -3065,9 +3067,9 @@ export class XmlParser {
30653067
// nativescript-core/index.d.ts:117:5 - (ae-forgotten-export) The symbol "layout" needs to be exported by the entry point index.d.ts
30663068
// nativescript-core/index.d.ts:118:5 - (ae-forgotten-export) The symbol "ad" needs to be exported by the entry point index.d.ts
30673069
// nativescript-core/index.d.ts:119:5 - (ae-forgotten-export) The symbol "ios" needs to be exported by the entry point index.d.ts
3068-
// 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
3069-
// 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
3070-
// 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
3070+
// 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
3071+
// 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
3072+
// 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
30713073

30723074
// (No @packageDocumentation comment for this package)
30733075

nativescript-core/ui/core/view-base/view-base.d.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,15 @@ export interface ShowModalOptions {
7979
/**
8080
* The UIModalPresentationStyle to be used when showing the dialog in iOS .
8181
*/
82-
presentationStyle: any /* UIModalPresentationStyle */
82+
presentationStyle?: any; /* UIModalPresentationStyle */
83+
/**
84+
* width of the popup dialog
85+
*/
86+
width?: number;
87+
/**
88+
* height of the popup dialog
89+
*/
90+
height?: number;
8391
}
8492
android?: {
8593
/**

nativescript-core/ui/core/view/view.ios.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,11 @@ export class View extends ViewCommon implements ViewDefinition {
432432
controller.modalPresentationStyle = UIModalPresentationStyle.FullScreen;
433433
} else {
434434
controller.modalPresentationStyle = UIModalPresentationStyle.FormSheet;
435+
//check whether both height and width is provided and are positive numbers
436+
// set it has prefered content size to the controller presenting the dialog
437+
if (options.ios && options.ios.width > 0 && options.ios.height > 0) {
438+
controller.preferredContentSize = CGSizeMake(options.ios.width, options.ios.height);
439+
}
435440
}
436441

437442
if (options.ios && options.ios.presentationStyle) {

0 commit comments

Comments
 (0)