Skip to content

Android - Back navigation breaks with nested page-router-outlets. #1776

Open
@sbknick

Description

@sbknick

Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI: 5.3.0
  • Android Runtime: 5.1.0
  • NativeScript-Angular: 7.1.0
  • Angular: 7.1.0

Describe the bug
On Android, navigation history is broken when navigating backward via nested page-router-outlets. Note: This works as expected on iOS just fine.

To Reproduce

  1. Create a NS Angular project with routes like so...
{ path: "", redirectTo: "/home/(homeoutlet:lounge)", pathMatch: "full" },
{ path: "home", component: HomeComponent, children: [
    { path: "lounge", component: LoungeComponent, outlet: "homeoutlet" },
    { path: "garage", component: GarageComponent, outlet: "homeoutlet" }
] },
{ path: "work", component: WorkComponent }
  1. On the Lounge page, add a button to navigate to "/home/(homeoutlet:garage)"
  2. On the Garage page, add buttons to navigate "routerExtensions.back()" and to "/work".
  3. On the Work page, add a button to navigate "routerExtendsion.back()".
  4. Run the app.
  5. Starting at Home/Lounge, navigate to Home/Garage then to Work. Then go back() and attempt to go back() again.
  6. The page will remain on the Home/Garage page despite that not being the start of the nav stack.

Expected behavior
If I navigate from home/lounge -> home/garage -> work, then i press back() twice, I should return to home/lounge.

Sample project
https://github.com/sbknick/ns-android-nested-back-nav

Additional context
On iOS, this functions as expected.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions