0

I upgraded to the newest NativeScript version (8.4) with Angular 13. tns doctor says everything is OK.

I have an outlet. The root route is a page with a mapbox map. When I navigate forward from the root route in the same outlet, everything happens as expected, I get the new page perfectly.

But when I navigate back I can see the previous Page for one second, then a blank screen, then the same page re-starts.

I can see in the console ngOninit() runs again when it shouldn't do anything just show the previous page again.

I figured out the map gets duplicated and it causes crashes.

    if (this._routerExtensions.canGoBack) {
      this._routerExtensions.back({ relativeTo: this.route });
    }
  {
    path: 'map',
    component: NSEmptyOutletComponent,

    loadChildren: () =>
      import('../../../libs/xplat/nativescript/features/src/lib/pages/map').then(m => m.MapModule),
    outlet: 'map',
    canActivate: [AuthGuard]

  },
  {
    path: 'nearby/:id',
    //component: NSEmptyOutletComponent, // navigating back doesn't work when this is active
    loadChildren: () =>
      import('../../../libs/xplat/nativescript/features/src/lib/pages/nearby').then(m => m.NearbyModule),
    outlet: 'map',
    canActivate: [AuthGuard]

  },

Everything worked perfectly with 8.2, I had to upgrade because 8.2 couldn't handle the downloaded files after Android 11.

Peter
  • 748
  • 6
  • 20

1 Answers1

0

I suggest updating to latest angular (and @nativescript/angular) as a lot of fixes regarding navigation were done since angular 13.

Eduardo Speroni
  • 341
  • 2
  • 8