FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(modal): missing animated & stretched params by ddfreiling · Pull Request #1293 · NativeScript/nativescript-angular · GitHub

14 changes: 12 additions & 2 deletions nativescript-angular/directives/dialogs.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import { PageFactory, PAGE_FACTORY } from "../platform-providers";
export interface ModalDialogOptions {
context?: any;
fullscreen?: boolean;
animated?: boolean;
stretched?: boolean;
viewContainerRef?: ViewContainerRef;
moduleRef?: NgModuleRef<any>;
}
Expand All @@ -36,6 +38,8 @@ interface ShowDialogOptions {
context: any;
doneCallback;
fullscreen: boolean;
animated: boolean;
stretched: boolean;
pageFactory: PageFactory;
parentView: ViewBase;
resolver: ComponentFactoryResolver;
Expand All @@ -48,7 +52,7 @@ export class ModalDialogService {
}

public showModal(type: Type<any>,
{ viewContainerRef, moduleRef, context, fullscreen }: ModalDialogOptions
{ viewContainerRef, moduleRef, context, fullscreen, animated, stretched }: ModalDialogOptions
): Promise<any> {
if (!viewContainerRef) {
throw new Error(
Expand Down Expand Up @@ -77,6 +81,8 @@ export class ModalDialogService {
context,
doneCallback: resolve,
fullscreen,
animated,
stretched,
pageFactory,
parentView,
resolver,
Expand All @@ -90,6 +96,8 @@ export class ModalDialogService {
context,
doneCallback,
fullscreen,
animated,
stretched,
pageFactory,
parentView,
resolver,
Expand Down Expand Up @@ -132,7 +140,9 @@ export class ModalDialogService {
(<any>componentView.parent).removeChild(componentView);
}

parentView.showModal(componentView, context, closeCallback, fullscreen);
// TODO: remove <any> cast after https://github.com/NativeScript/NativeScript/pull/5734
// is in a published version of tns-core-modules.
(<any>parentView).showModal(componentView, context, closeCallback, fullscreen, animated, stretched);
});
}
}
Expand Down
8 changes: 6 additions & 2 deletions ng-sample/app/examples/modal/modal-test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { ModalContent } from "./modal-content";
<GridLayout rows="*, auto">
<StackLayout verticalAlignment="top" margin="12">
<Button text="show component" (tap)="showModal(false)"></Button>
<Button text="show component no anim (ios)" (tap)="showModal(false, false)"></Button>
<Button text="show component stretched (android)" (tap)="showModal(false, false, true)"></Button>
<Button text="show component fullscreen" (tap)="showModal(true)"></Button>

<Button text="alert" (tap)="showAlert()"></Button>
Expand All @@ -33,10 +35,12 @@ export class ModalTest {

static exports = [];

public showModal(fullscreen: boolean) {
public showModal(fullscreen: boolean, animated = true, stretched = false) {
const options: ModalDialogOptions = {
context: { promptMsg: "This is the prompt message!" },
fullscreen: fullscreen,
fullscreen,
animated,
stretched,
viewContainerRef: this.vcRef
};

Expand Down

Back | FazBrowse Home | New Git URL