Skip to content

Prepare 701 #1619

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Nov 20, 2018
Merged
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ env:
- NODE_VERSION=8
- EMULATOR_API_LEVEL=23
- ANDROID_VERSION=28
- ANDROID_BUILD_TOOLS_VERSION=28.0.2
- ANDROID_BUILD_TOOLS_VERSION=28.0.3
- ANDROID_ABI=armeabi-v7a
- EMULATOR_NAME=test
- ANDROID_TAG=google_apis
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
<a name="7.0.1"></a>
## [7.0.1](https://github.com/NativeScript/nativescript-angular/compare/7.0.0...7.0.1) (2018-11-20)


### Bug Fixes

* crash in deactivate page router outlet ([#1590](https://github.com/NativeScript/nativescript-angular/issues/1590)) ([f8c7468](https://github.com/NativeScript/nativescript-angular/commit/f8c7468))
* **dialogs:** unable to reopen shared modal view when tab as root ([199c245](https://github.com/NativeScript/nativescript-angular/commit/199c245))
* **location-strategy:** crash when going back on nested named lazy loaded module ([#1618](https://github.com/NativeScript/nativescript-angular/issues/1618)) ([d9ffb83](https://github.com/NativeScript/nativescript-angular/commit/d9ffb83))



<a name="7.0.0"></a>
# [7.0.0](https://github.com/NativeScript/nativescript-angular/compare/6.2.0...7.0.0) (2018-11-12)

Expand Down
12 changes: 12 additions & 0 deletions e2e/modal-navigation-ng/app/app.android.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Button{
font-size: 8;
margin: 0px;
padding: 0px;
height: 40;
}

TextView {
font-size: 10;
margin: 0px;
padding: 0px;
}
53 changes: 38 additions & 15 deletions e2e/modal-navigation-ng/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,47 @@ import { NSLocationStrategy } from "nativescript-angular/router/ns-location-stra

import { ViewContainerRefService } from "./shared/ViewContainerRefService";

import { AppModule } from "./app.module";
import { ModalDialogOptions, ModalDialogService } from "nativescript-angular";
import { ModalViewComponent } from "./modal-shared/modal-view.component";

@Component({
selector: "ns-app",
templateUrl: "app.component.html",
selector: "ns-app",
templateUrl: "app.component.html"
})

export class AppComponent {
constructor(
router: Router,
location: NSLocationStrategy,
private _vcRef: ViewContainerRef,
private _viewContainerRefService: ViewContainerRefService) {
router.events.subscribe(e => {
if (e instanceof NavigationEnd) {
console.log("[ROUTER]: " + e.toString());
console.log(location.toString());
}
});
constructor(
router: Router,
location: NSLocationStrategy,
private modal: ModalDialogService,
private _vcRef: ViewContainerRef,
private _viewContainerRefService: ViewContainerRefService) {
router.events.subscribe(e => {
if (e instanceof NavigationEnd) {
console.log("[ROUTER]: " + e.toString());
console.log(location.toString());
}
});

this._viewContainerRefService.root = this._vcRef;
}

this._viewContainerRefService.root = this._vcRef;
ngOnInit() {
if (AppModule.root === "page-router-modal") {
this.onRootModalTap();
console.log("Page modal page from frame root");
}
}

onRootModalTap(): void {
const options: ModalDialogOptions = {
viewContainerRef: this._viewContainerRefService.root,
context: {},
fullscreen: true
};

this.modal.showModal(ModalViewComponent, options).then((result: string) => {
console.log(result);
});
}
}
3 changes: 1 addition & 2 deletions e2e/modal-navigation-ng/app/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ In many cases you may want to use the NativeScript core theme instead
of writing your own CSS rules. For a full list of class names in the theme
refer to http://docs.nativescript.org/ui/theme.
*/
@import '~nativescript-theme-core/css/core.light.css';
Button {
font-size: 10px;
}
}
12 changes: 12 additions & 0 deletions e2e/modal-navigation-ng/app/app.ios.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#home-page {
font-size: 10;
margin: 0px;
padding: 0px;
}
#home-page Button {
margin-bottom: 20px;
padding: 20px;
border-color: gray;
border-width: 2px;
border-radius: 8px;
}
10 changes: 9 additions & 1 deletion e2e/modal-navigation-ng/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { TabComponent } from "./tab.component";
import { LayoutComponent } from "./layout.component";

import { HomeComponent } from "./home/home.component";
import { RootSectionComponent } from "./navigation/root.section.component";
import { BasicsNavigationComponent } from "./navigation/basic.navigation.component";
import { SecondComponent } from "./second/second.component";
import { ModalSecondComponent } from "./modal-second/modal-second.component";
import { ModalComponent } from "./modal/modal.component";
Expand Down Expand Up @@ -44,6 +46,8 @@ traceEnable();
NamedRouterComponent,
TabComponent,
LayoutComponent,
RootSectionComponent,
BasicsNavigationComponent,
HomeComponent,
SecondComponent,
ModalComponent,
Expand Down Expand Up @@ -78,9 +82,13 @@ export class AppModule {
static bootstrapRootComponent() {
const options = {
'page-router': AppComponent,
'page-router-modal': AppComponent,
'named-page-router': NamedRouterComponent,
'named-page-router-modal': NamedRouterComponent,
'tab': TabComponent,
'layout': LayoutComponent
'tab-modal': TabComponent,
'layout': LayoutComponent,
'layout-modal': LayoutComponent,
};

const component = options[AppModule.root];
Expand Down
23 changes: 17 additions & 6 deletions e2e/modal-navigation-ng/app/app.routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ const routesTab: Routes = [
path: "modal-second", component: ModalSecondComponent
}
]
},
{
path: "modal-shared", component: ModalViewContentComponent, outlet: "modalOutlet"
},
{
path: "modal-shared-second-host", component: ModalSharedSecondComponent
}
];

Expand All @@ -110,23 +116,28 @@ const routesLayout: Routes = [
path: "modal", component: ModalComponent, children: [
{ path: "nested-frame-modal", component: NestedModalComponent }]
},
{ path: "modal-second", component: ModalSecondComponent }
{ path: "modal-second", component: ModalSecondComponent },
{
path: "modal-shared", component: ModalViewContentComponent, outlet: "modalOutlet"
},
{
path: "modal-shared-second-host", component: ModalSharedSecondComponent
}
]


@NgModule({
imports: [NativeScriptRouterModule.forRoot(routes)],
exports: [NativeScriptRouterModule]
})
export class AppRoutingModule {
constructor(private router: Router) {
if (AppModule.root === "page-router") {
if (AppModule.root === "page-router" || AppModule.root === "page-router-modal") {
this.router.resetConfig(routes);
} else if (AppModule.root === "layout") {
} else if (AppModule.root === "layout" || AppModule.root === "layout-modal") {
this.router.resetConfig(routesLayout);
} else if (AppModule.root === "named-page-router") {
} else if (AppModule.root === "named-page-router" || AppModule.root === "named-page-router-modal") {
this.router.resetConfig(namedOutletRoutes);
} else {
} else if(AppModule.root === "tab" || AppModule.root === "tab-modal"){
this.router.resetConfig(routesTab);
}
}
Expand Down
27 changes: 12 additions & 15 deletions e2e/modal-navigation-ng/app/home/home.component.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
<ActionBar class="action-bar">
<Label class="action-bar-title" text="Home Component" automationText="Home Component" ></Label>
<ActionBar >
<Label text="Home Component" automationText="Home Component"></Label>
</ActionBar>

<WrapLayout>
<Button text="Show Modal Without Frame" (tap)="onModalNoFrame()"></Button>
<Button text="Show Modal Page With Frame" (tap)="onModalFrame()"></Button>
<Button text="Navigate To Second Page" (tap)="onNavigateSecond()"></Button>
<Button text="Reset Named Frame Root View" (tap)="onNamedFrameRootViewReset()"></Button>
<Button text="Reset Frame Root View" (tap)="onFrameRootViewReset()"></Button>
<Button text="Reset Tab Root View" (tap)="onTabRootViewReset()"></Button>
<Button text="Reset Layout Root View" automationText="Reset Layout Root View" (tap)="onLayoutRootViewReset()"></Button>
<Button text="Show Dialog" (tap)="onShowDialog()"></Button>

<Button text="show shared modal" (tap)="onRootModalTap()"></Button>
<Button text="go to second (to open shared modal)" [nsRouterLink]="['/modal-shared-second-host']"></Button>
</WrapLayout>
<GridLayout rows="auto, auto" columns="auto, *" >
<root-section row="0" col="0" ></root-section>
<StackLayout id="home-page" row="0" col="1" borderColor="blue" borderWidth="1" borderRadius="5" marginLeft="2"
padding="2">
<basic-nav></basic-nav>
<Button text="Navigate To Second Page" (tap)="onNavigateSecond()" textAlignment="left"></Button>
<Button text="Navigate To Second Page Named Outlet" (tap)="onNavigateSecondWithOutlet()" textAlignment="left"></Button>
<Button text="Go To Second (to open shared modal)" [nsRouterLink]="['/modal-shared-second-host']" textAlignment="left"></Button>
</StackLayout>
</GridLayout>
103 changes: 16 additions & 87 deletions e2e/modal-navigation-ng/app/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,93 +12,22 @@ import { confirm } from "tns-core-modules/ui/dialogs";
import { AppModule } from "../app.module";

@Component({
moduleId: module.id,
selector: "home-page",
templateUrl: "./home.component.html"
moduleId: module.id,
selector: "home-page",
templateUrl: "./home.component.html"
})
export class HomeComponent {
constructor(
private modal: ModalDialogService,
private vcRef: ViewContainerRef,
private viewContainerRefService: ViewContainerRefService,
private routerExtension: RouterExtensions) { }

onModalNoFrame() {
const options: ModalDialogOptions = {
context: {
navigationVisibility: false
},
fullscreen: true,
viewContainerRef: this.vcRef
};

this.modal.showModal(ModalComponent, options).then((res: string) => {
console.log("moda-no-frame closed");
});
}

onModalFrame() {
const options: ModalDialogOptions = {
context: {
navigationVisibility: true,
modalRoute: "modal"
},
fullscreen: true,
viewContainerRef: this.vcRef
};

this.modal.showModal(ModalRouterComponent, options).then((res: string) => {
console.log("moda-frame closed");
});
}

onNavigateSecond() {
this.routerExtension.navigate(["second"]);
}

onFrameRootViewReset() {
AppModule.root = "page-router";
AppModule.platformRef._livesync();
}

onNamedFrameRootViewReset() {
AppModule.root = "named-page-router";
AppModule.platformRef._livesync();
}

onTabRootViewReset() {
AppModule.root = "tab";
AppModule.platformRef._livesync();
}

onLayoutRootViewReset() {
AppModule.root = "layout";
AppModule.platformRef._livesync();
}

onRootModalTap(): void {
const options: ModalDialogOptions = {
viewContainerRef: this.viewContainerRefService.root,
context: {},
fullscreen: true
};

this.modal.showModal(ModalViewComponent, options)
.then((result: string) => {
console.log(result);
});
}

onShowDialog() {
let options = {
title: "Dialog",
message: "Message",
okButtonText: "Yes",
cancelButtonText: "No"
}

confirm(options).then((result: boolean) => {
console.log(result);
})
}
constructor(
private modal: ModalDialogService,
private vcRef: ViewContainerRef,
private viewContainerRefService: ViewContainerRefService,
private routerExtension: RouterExtensions) { }

onNavigateSecond() {
this.routerExtension.navigate(["second"]);
}

onNavigateSecondWithOutlet() {
this.routerExtension.navigate([ { outlets: { namedRouter:["second"] } }]);
}
}
14 changes: 4 additions & 10 deletions e2e/modal-navigation-ng/app/layout.component.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
<WrapLayout>
<Label text="Home Component" horizontalAlignment="center"></Label>
<Button text="Show Modal Without Frame" (tap)="onModalNoFrame()"></Button>
<Button text="Show Modal Page With Frame" (tap)="onModalFrame()"></Button>
<Button text="Reset Named Frame Root View" (tap)="onNamedFrameRootViewReset()"></Button>
<Button text="Reset Frame Root View" (tap)="onFrameRootViewReset()"></Button>
<Button text="Reset Tab Root View" (tap)="onTabRootViewReset()"></Button>
<Button text="Reset Layout Root View" (tap)="onLayoutRootViewReset()"></Button>
<Button text="Show Dialog" (tap)="onShowDialog()"></Button>
</WrapLayout>
<GridLayout columns="auto, *" automationText="Home Component" >
<root-section></root-section>
<basic-nav col="1" ></basic-nav>
</GridLayout>
Loading