Skip to content

Commit a3c75a8

Browse files
author
Marcus Williams
committed
update
1 parent a51b59c commit a3c75a8

File tree

4 files changed

+21
-8
lines changed

4 files changed

+21
-8
lines changed

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

+6-2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export interface ModalDialogOptions {
2626
stretched?: boolean;
2727
viewContainerRef?: ViewContainerRef;
2828
moduleRef?: NgModuleRef<any>;
29+
ios?: any;
2930
}
3031

3132
export class ModalDialogParams {
@@ -46,6 +47,7 @@ interface ShowDialogOptions {
4647
parentView: ViewBase;
4748
resolver: ComponentFactoryResolver;
4849
type: Type<any>;
50+
ios: any;
4951
}
5052

5153
@Injectable()
@@ -54,7 +56,7 @@ export class ModalDialogService {
5456
}
5557

5658
public showModal(type: Type<any>,
57-
{ viewContainerRef, moduleRef, context, fullscreen, animated, stretched }: ModalDialogOptions
59+
{ viewContainerRef, moduleRef, context, fullscreen, animated, stretched, ios }: ModalDialogOptions
5860
): Promise<any> {
5961
if (!viewContainerRef) {
6062
throw new Error(
@@ -105,6 +107,7 @@ export class ModalDialogService {
105107
parentView,
106108
resolver,
107109
type,
110+
ios
108111
});
109112
} catch (err) {
110113
reject(err);
@@ -124,6 +127,7 @@ export class ModalDialogService {
124127
parentView,
125128
resolver,
126129
type,
130+
ios
127131
}: ShowDialogOptions): void {
128132
let componentView: View;
129133
let detachedLoaderRef: ComponentRef<DetachedLoader>;
@@ -161,7 +165,7 @@ export class ModalDialogService {
161165

162166
// TODO: remove <any> cast after https://github.com/NativeScript/NativeScript/pull/5734
163167
// is in a published version of tns-core-modules.
164-
(<any>parentView).showModal(componentView, context, closeCallback, fullscreen, animated, stretched);
168+
(<any>parentView).showModal(componentView, context, closeCallback, fullscreen, animated, stretched, ios);
165169
});
166170
}
167171
}

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

+9-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { ModalContent } from "./modal-content";
1212
<Button text="show component no anim (ios)" (tap)="showModal(false, false)"></Button>
1313
<Button text="show component stretched (android)" (tap)="showModal(false, false, true)"></Button>
1414
<Button text="show component fullscreen" (tap)="showModal(true)"></Button>
15+
<Button text="show component popover" (tap)="showModal(false, true, false, true)"></Button>
1516
1617
<Button text="alert" (tap)="showAlert()"></Button>
1718
<Button text="confirm" (tap)="showConfirm()"></Button>
@@ -35,15 +36,21 @@ export class ModalTest {
3536

3637
static exports = [];
3738

38-
public showModal(fullscreen: boolean, animated = true, stretched = false) {
39-
const options: ModalDialogOptions = {
39+
public showModal(fullscreen: boolean, animated = true, stretched = false, popover = false) {
40+
let options: ModalDialogOptions = {
4041
context: { promptMsg: "This is the prompt message!" },
4142
fullscreen,
4243
animated,
4344
stretched,
4445
viewContainerRef: this.vcRef
4546
};
4647

48+
if (popover) {
49+
options.ios = {
50+
presentationStyle: UIModalPresentationStyle.Popover
51+
};
52+
}
53+
4754
this.modal.showModal(ModalContent, options).then((res: string) => {
4855
this.result = res || "empty result";
4956
});

Diff for: ng-sample/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"version": "next"
66
},
77
"tns-ios": {
8-
"version": "next"
8+
"version": "5.2.0-2019-02-01-153600-01"
99
}
1010
},
1111
"name": "tns-template-hello-world",
@@ -42,9 +42,8 @@
4242
"@angular/platform-browser-dynamic": "~7.2.0",
4343
"@angular/router": "~7.2.0",
4444
"nativescript-angular": "file:../nativescript-angular",
45-
"rxjs": "~6.3.3",
45+
"rxjs": "^6.3.3",
4646
"tns-core-modules": "next",
47-
"tns-platform-declarations": "next",
4847
"zone.js": "^0.8.4"
4948
},
5049
"devDependencies": {
@@ -55,6 +54,7 @@
5554
"lazy": "1.0.11",
5655
"nativescript-dev-typescript": "next",
5756
"shelljs": "^0.7.0",
57+
"tns-platform-declarations": "^5.1.2",
5858
"tslint": "^4.5.1",
5959
"typescript": "~3.1.1"
6060
},

Diff for: ng-sample/references.d.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
/// <reference path="./node_modules/tns-core-modules/tns-core-modules.d.ts" /> Needed for autocompletion and compilation.
1+
/// <reference path="./node_modules/tns-core-modules/tns-core-modules.d.ts" /> Needed for autocompletion and compilation.
2+
/// <reference path="./node_modules/tns-platform-declarations/ios.d.ts" />
3+
/// <reference path="./node_modules/tns-platform-declarations/android.d.ts" />

0 commit comments

Comments
 (0)