Skip to content

Commit a9a901b

Browse files
ddfreilingmanoldonev
authored andcommitted
fix(modal): missing animated & stretched params (#1293)
1 parent d27a893 commit a9a901b

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

Diff for: nativescript-angular/directives/dialogs.ts

+12-2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import { PageFactory, PAGE_FACTORY } from "../platform-providers";
2020
export interface ModalDialogOptions {
2121
context?: any;
2222
fullscreen?: boolean;
23+
animated?: boolean;
24+
stretched?: boolean;
2325
viewContainerRef?: ViewContainerRef;
2426
moduleRef?: NgModuleRef<any>;
2527
}
@@ -36,6 +38,8 @@ interface ShowDialogOptions {
3638
context: any;
3739
doneCallback;
3840
fullscreen: boolean;
41+
animated: boolean;
42+
stretched: boolean;
3943
pageFactory: PageFactory;
4044
parentView: ViewBase;
4145
resolver: ComponentFactoryResolver;
@@ -48,7 +52,7 @@ export class ModalDialogService {
4852
}
4953

5054
public showModal(type: Type<any>,
51-
{ viewContainerRef, moduleRef, context, fullscreen }: ModalDialogOptions
55+
{ viewContainerRef, moduleRef, context, fullscreen, animated, stretched }: ModalDialogOptions
5256
): Promise<any> {
5357
if (!viewContainerRef) {
5458
throw new Error(
@@ -77,6 +81,8 @@ export class ModalDialogService {
7781
context,
7882
doneCallback: resolve,
7983
fullscreen,
84+
animated,
85+
stretched,
8086
pageFactory,
8187
parentView,
8288
resolver,
@@ -90,6 +96,8 @@ export class ModalDialogService {
9096
context,
9197
doneCallback,
9298
fullscreen,
99+
animated,
100+
stretched,
93101
pageFactory,
94102
parentView,
95103
resolver,
@@ -132,7 +140,9 @@ export class ModalDialogService {
132140
(<any>componentView.parent).removeChild(componentView);
133141
}
134142

135-
parentView.showModal(componentView, context, closeCallback, fullscreen);
143+
// TODO: remove <any> cast after https://github.com/NativeScript/NativeScript/pull/5734
144+
// is in a published version of tns-core-modules.
145+
(<any>parentView).showModal(componentView, context, closeCallback, fullscreen, animated, stretched);
136146
});
137147
}
138148
}

Diff for: ng-sample/app/examples/modal/modal-test.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import { ModalContent } from "./modal-content";
99
<GridLayout rows="*, auto">
1010
<StackLayout verticalAlignment="top" margin="12">
1111
<Button text="show component" (tap)="showModal(false)"></Button>
12+
<Button text="show component no anim (ios)" (tap)="showModal(false, false)"></Button>
13+
<Button text="show component stretched (android)" (tap)="showModal(false, false, true)"></Button>
1214
<Button text="show component fullscreen" (tap)="showModal(true)"></Button>
1315
1416
<Button text="alert" (tap)="showAlert()"></Button>
@@ -33,10 +35,12 @@ export class ModalTest {
3335

3436
static exports = [];
3537

36-
public showModal(fullscreen: boolean) {
38+
public showModal(fullscreen: boolean, animated = true, stretched = false) {
3739
const options: ModalDialogOptions = {
3840
context: { promptMsg: "This is the prompt message!" },
39-
fullscreen: fullscreen,
41+
fullscreen,
42+
animated,
43+
stretched,
4044
viewContainerRef: this.vcRef
4145
};
4246

0 commit comments

Comments
 (0)