Skip to content

Commit 7886b86

Browse files
vchimevADjenkov
authored and
ADjenkov
committed
fix-next(dialogs): showModal dialog of selector template as root
Extend AppHostView class to overwrite the `content` property of ContentView.
1 parent 2a1c34a commit 7886b86

File tree

3 files changed

+94
-72
lines changed

3 files changed

+94
-72
lines changed

Diff for: nativescript-angular/app-host-view.ts

+36-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,41 @@
11
import { ContentView } from "tns-core-modules/ui/content-view";
2+
import { GridLayout } from "tns-core-modules/ui/layouts/grid-layout";
23
import { ViewBase } from "tns-core-modules/ui/core/view/view";
4+
import { ProxyViewContainer } from "tns-core-modules/ui/proxy-view-container";
5+
import { View } from "tns-core-modules/ui/core/view";
36

47
export class AppHostView extends ContentView {
5-
ngAppRoot: ViewBase;
8+
9+
private _ngAppRoot: View;
10+
private _content: View;
11+
12+
get ngAppRoot(): View {
13+
return this._ngAppRoot;
14+
}
15+
16+
set ngAppRoot(value: View) {
17+
this._ngAppRoot = value;
18+
}
19+
20+
get content(): View {
21+
return this._content;
22+
}
23+
24+
set content(value: View) {
25+
if (this._content) {
26+
this._content.parentNode = undefined;
27+
}
28+
29+
this._content = value;
30+
this._content.parentNode = this;
31+
32+
this.ngAppRoot = value;
33+
34+
if (this._content instanceof ProxyViewContainer) {
35+
const grid = new GridLayout();
36+
grid.addChild(this._content);
37+
this.ngAppRoot = grid;
38+
}
39+
}
40+
641
}

Diff for: ng-sample/.vscode/launch.json

+56-70
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,58 @@
11
{
2-
"version": "0.2.0",
3-
"configurations": [
4-
{
5-
"name": "Sync on iOS",
6-
"type": "nativescript",
7-
"platform": "ios",
8-
"request": "launch",
9-
"appRoot": "${workspaceRoot}",
10-
"sourceMaps": true,
11-
"diagnosticLogging": false,
12-
"emulator": false,
13-
"rebuild": false,
14-
"syncAllFiles": false
15-
},
16-
{
17-
"name": "Launch on iOS",
18-
"type": "nativescript",
19-
"platform": "ios",
20-
"request": "launch",
21-
"appRoot": "${workspaceRoot}",
22-
"sourceMaps": true,
23-
"diagnosticLogging": false,
24-
"emulator": false,
25-
"rebuild": true,
26-
"stopOnEntry": true
27-
},
28-
{
29-
"name": "Attach on iOS",
30-
"type": "nativescript",
31-
"platform": "ios",
32-
"request": "attach",
33-
"appRoot": "${workspaceRoot}",
34-
"sourceMaps": true,
35-
"diagnosticLogging": false,
36-
"emulator": false
37-
},
38-
{
39-
"name": "Sync on Android",
40-
"type": "nativescript",
41-
"platform": "android",
42-
"request": "launch",
43-
"appRoot": "${workspaceRoot}",
44-
"sourceMaps": true,
45-
"diagnosticLogging": false,
46-
"emulator": false,
47-
"rebuild": false
48-
},
49-
{
50-
"name": "Launch on Android",
51-
"type": "nativescript",
52-
"platform": "android",
53-
"request": "launch",
54-
"appRoot": "${workspaceRoot}",
55-
"sourceMaps": true,
56-
"diagnosticLogging": false,
57-
"emulator": false,
58-
"rebuild": true,
59-
"stopOnEntry": true
60-
},
61-
{
62-
"name": "Attach on Android",
63-
"type": "nativescript",
64-
"platform": "android",
65-
"request": "attach",
66-
"appRoot": "${workspaceRoot}",
67-
"sourceMaps": true,
68-
"diagnosticLogging": false,
69-
"emulator": false
70-
}
71-
]
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Launch on iOS",
9+
"type": "nativescript",
10+
"request": "launch",
11+
"platform": "ios",
12+
"appRoot": "${workspaceRoot}",
13+
"sourceMaps": true,
14+
"stopOnEntry": true,
15+
"tnsArgs": [
16+
"--syncAllFiles"
17+
],
18+
"watch": true
19+
},
20+
{
21+
"name": "Attach on iOS",
22+
"type": "nativescript",
23+
"request": "attach",
24+
"platform": "ios",
25+
"appRoot": "${workspaceRoot}",
26+
"sourceMaps": true,
27+
"tnsArgs": [
28+
"--syncAllFiles"
29+
],
30+
"watch": false
31+
},
32+
{
33+
"name": "Launch on Android",
34+
"type": "nativescript",
35+
"request": "launch",
36+
"platform": "android",
37+
"appRoot": "${workspaceRoot}",
38+
"sourceMaps": true,
39+
"stopOnEntry": false,
40+
"tnsArgs": [
41+
"--syncAllFiles"
42+
],
43+
"watch": true
44+
},
45+
{
46+
"name": "Attach on Android",
47+
"type": "nativescript",
48+
"request": "attach",
49+
"platform": "android",
50+
"appRoot": "${workspaceRoot}",
51+
"sourceMaps": true,
52+
"tnsArgs": [
53+
"--syncAllFiles"
54+
],
55+
"watch": false
56+
}
57+
]
7258
}

Diff for: ng-sample/app/app.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -187,4 +187,5 @@ onAfterLivesync.subscribe(({ moduleRef, error }) => {
187187

188188
// platformNativeScriptDynamic().bootstrapModule(makeExampleModule(LivesyncApp));
189189
// console.log("APP RESTART!!!! !!!");
190-
platformNativeScriptDynamic().bootstrapModule(makeExampleModule(ModalTest));
190+
// platformNativeScriptDynamic().bootstrapModule(makeExampleModule(ModalTest));
191+
platformNativeScriptDynamic().bootstrapModule(makeExampleModule(ModalNestedTest));

0 commit comments

Comments
 (0)