Skip to content

Commit 52508aa

Browse files
committed
Revert "feat: add lazy loaded modal and lazy routing tests"
This reverts commit 255208a.
1 parent 255208a commit 52508aa

20 files changed

+202
-178
lines changed

Diff for: app/app.css

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
@import '~/nativescript-theme-core/css/core.light.css';
2-
3-
button {
1+
button {
42
font-size: 13;
53
}
64

@@ -12,4 +10,3 @@ label {
1210
font-family: 'Courier'; /* Enabling this results in the error and shows a blank TabView */
1311
}
1412

15-

Diff for: app/app.module.ts

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { NgModule, NgModuleFactoryLoader, NO_ERRORS_SCHEMA } from "@angular/core";
1+
import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core";
22
import { NativeScriptModule } from "nativescript-angular/nativescript.module";
3-
import { NSModuleFactoryLoader } from "nativescript-angular/router";
43

54
import { NavigationMainPageRouter } from "./main/main-page-router-outlet";
65
import { routableComponents, routes } from "./app.routes";
@@ -23,12 +22,6 @@ import { CustomTemplate } from "./list-view/list-view-item-template";
2322
NativeScriptRouterModule,
2423
NativeScriptRouterModule.forRoot(routes),
2524
],
26-
providers: [
27-
{
28-
provide: NgModuleFactoryLoader,
29-
useClass: NSModuleFactoryLoader
30-
}
31-
],
3225
schemas: [NO_ERRORS_SCHEMA],
3326
})
3427
export class AppModule { }

Diff for: app/app.routes.ts

+5-17
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ import { SecondComponentActionBar } from "./action-bar/action-bar-second.compone
55

66
import { AppComponent } from "./template/app.component";
77

8-
import { FirstComponent } from "./router/router-outlet/first.component";
9-
import { SecondComponent } from "./router/router-outlet/second.component";
10-
import { NavigationComponent, NavigationSubRoutes } from "./router/router-outlet/navigation.component";
11-
import { LazyNavigationComponent } from "./router/lazy-module-navigation/lazy-navigation.component";
8+
import { FirstComponent } from "./components/first.component";
9+
import { SecondComponent } from "./components/second.component";
10+
import { NavigationTestRouter, NavigationSubRoutes } from "./router/router-outlet";
1211

1312
import { BindingComponent } from "./binding/binding-page";
1413

@@ -23,7 +22,6 @@ import { ListPickerComponent } from "./list-picker/list-picker";
2322

2423
import { ModalTest, ModalTestWithPushStrategy, ModalContent } from "./modal/modal-dialogs/modal-dialog.component";
2524
import { ModalViewMainPageComponent } from "./modal/modal-view-main-page";
26-
import { LazyLoadModalComponent } from "./modal/lazy/lazy-load-modal.component";
2725

2826
import { TabViewComponent } from "./tab-view/tab-view.component";
2927

@@ -36,8 +34,7 @@ export const routableComponents = [
3634
ModalContent,
3735
AppComponent,
3836

39-
NavigationComponent,
40-
LazyNavigationComponent,
37+
NavigationTestRouter,
4138

4239
FirstComponent,
4340
SecondComponent,
@@ -59,7 +56,6 @@ export const routableComponents = [
5956
ModalViewMainPageComponent,
6057
ModalTest,
6158
ModalTestWithPushStrategy,
62-
LazyLoadModalComponent,
6359

6460
TabViewComponent,
6561

@@ -73,8 +69,7 @@ export const routes = [
7369
{ path: '', component: ModalContent, data: { title: "" } },
7470
{ path: 'template', component: AppComponent, data: { title: "Template", isNavigatable: true} },
7571

76-
{ path: 'router', component: NavigationComponent, children: NavigationSubRoutes, data: { title: "Router", isNavigatable: true} },
77-
{ path: 'lazy-router', component: LazyNavigationComponent, data: { title: "Lazy Router", isNavigatable: true} },
72+
{ path: 'router', component: NavigationTestRouter, children: NavigationSubRoutes, data: { title: "Router", isNavigatable: true} },
7873

7974
{ path: 'first', component: FirstComponent, data: { title: "First", isNavigatable: true} },
8075
{ path: 'second', component: SecondComponent, data: { title: "Second", isNavigatable: true} },
@@ -96,17 +91,10 @@ export const routes = [
9691
{ path: 'modal', component: ModalViewMainPageComponent, data: { title: "Modals", isNavigatable: true} },
9792
{ path: 'modal/modal-dialogs', component: ModalTest, data: { title: "modal" } },
9893
{ path: 'modal/modal-dialogs-push', component: ModalTestWithPushStrategy, data: { title: "modal(onPush)" } },
99-
{ path: 'modal/lazy', component: LazyLoadModalComponent, data: { title: "modal(lazy)" } },
10094

10195
{ path: 'tab-view', component: TabViewComponent, data: { title: "tab-view", isNavigatable: true } },
10296

10397
{ path: 'nav-options', component: NavigationOptionsComponent, data: { title: "nav-options", isNavigatable: true} },
10498
{ path: 'nav-info', component: NavigationInfoComponent, data: { title: "nav-info" } },
105-
106-
// Needed for AoT compilation
107-
{
108-
path: "lazy",
109-
loadChildren: "./lazy/lazy.module#LazyModule"
110-
},
11199
];
112100

File renamed without changes.
File renamed without changes.

Diff for: app/lazy/lazy.component.html

-18
This file was deleted.

Diff for: app/lazy/lazy.component.ts

-30
This file was deleted.

Diff for: app/lazy/lazy.module.ts

-39
This file was deleted.

Diff for: app/main/main-page-router-outlet.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class MainComponent {
1616

1717
constructor() {
1818
let navigatableRoutes = this._routes.filter((item) => {
19-
return item.data && item.data.isNavigatable && item.path;
19+
return item.data.isNavigatable == true && item.path != '';
2020
});
2121

2222
this._pages = navigatableRoutes;

Diff for: app/modal/lazy/lazy-load-modal.component.ts

-38
This file was deleted.

Diff for: app/modal/modal-view-main-page.ts

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { Component } from "@angular/core";
66
<StackLayout>
77
<Button text="modal" [nsRouterLink]="['/modal','modal-dialogs']"></Button>
88
<Button text="modal(onPush)" [nsRouterLink]="['/modal','modal-dialogs-push']"></Button>
9-
<Button text="modal(lazy)" [nsRouterLink]="['/modal','lazy']"></Button>
109
</StackLayout>
1110
`,
1211
})

Diff for: app/router/lazy-module-navigation/lazy-navigation.component.ts

-7
This file was deleted.
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { Component } from "@angular/core";
2-
import { FirstComponent } from "./first.component";
3-
import { SecondComponent } from "./second.component";
1+
import {Component} from "@angular/core";
2+
import {FirstComponent} from "../components/first.component";
3+
import {SecondComponent} from "../components/second.component";
44

55
@Component({
66
moduleId: module.id,
7-
selector: "navigation-test",
8-
styleUrls: ["./navigation.component.css"],
7+
selector: 'navigation-test',
8+
styleUrls: ['./router-outlet.css'],
99
template: `
1010
<StackLayout>
1111
<StackLayout class="nav">
@@ -19,10 +19,10 @@ import { SecondComponent } from "./second.component";
1919
</StackLayout>
2020
`
2121
})
22-
export class NavigationComponent { }
22+
export class NavigationTestRouter { }
2323

2424
export var NavigationSubRoutes = [
25-
{ path: "", redirectTo: "first", pathMatch: "full" },
26-
{ path: "first", component: FirstComponent },
27-
{ path: "second", component: SecondComponent },
25+
{ path: '', redirectTo: 'first', pathMatch: "full" },
26+
{ path: 'first', component: FirstComponent },
27+
{ path: 'second', component: SecondComponent },
2828
];

Diff for: app/vendor-platform.android.ts

+22
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
// Resolve JavaScript classes that extend a Java class, and need to resolve
2+
// their JavaScript module from a bundled script. For example:
3+
// NativeScriptApplication, NativeScriptActivity, etc.
4+
//
5+
// This module gets bundled together with the rest of the app code and the
6+
// `require` calls get resolved to the correct bundling import call.
7+
//
8+
// At runtime the module gets loaded *before* the rest of the app code, so code
9+
// placed here needs to be careful about its dependencies.
10+
111
require("application");
212
require("ui/frame");
313
require("ui/frame/activity");
14+
15+
if (global.TNS_WEBPACK) {
16+
global.__requireOverride = function (name, dir) {
17+
if (name === "./tns_modules/application/application.js") {
18+
return require("application");
19+
} else if (name === "./tns_modules/ui/frame/frame.js") {
20+
return require("ui/frame");
21+
} else if (name === "./tns_modules/ui/frame/activity.js") {
22+
return require("ui/frame/activity");
23+
}
24+
};
25+
}

Diff for: package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
"@angular/router": "~4.1.0",
2323
"nativescript-angular": "next",
2424
"nativescript-intl": "~3.0.0",
25-
"nativescript-theme-core": "^1.0.4",
2625
"reflect-metadata": "~0.1.8",
2726
"rxjs": "^5.0.1",
2827
"tns-core-modules": "next",
@@ -54,4 +53,4 @@
5453
"build-android-bundle": "npm run ns-bundle --android --build-app",
5554
"build-ios-bundle": "npm run ns-bundle --ios --build-app"
5655
}
57-
}
56+
}

Diff for: webpack.android.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
var makeConfig = require("./webpack.common");
2+
module.exports = makeConfig("android");

0 commit comments

Comments
 (0)