Skip to content

Named outlets in BottomNavigation #2079

Open
@armpogart

Description

@armpogart

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: 6.2.0
  • Cross-platform modules: 6.2.1
  • Android Runtime: 6.2.0
  • iOS Runtime: 6.2.0
  • NativeScript-Angular: 8.20.3
  • Angular: 8.2.14

Describe the bug

Module children navigation for named outlets doesn't work in BottomNavigation.

To Reproduce

I have prepared 2 Playgrounds that show the issue:

The only difference between these version is in home.component.html.
The first version has

<StackLayout>
    <Label text="HomeComponent"></Label>
    <Label text="testTab outlet:"></Label>
    <router-outlet name="testTab"></router-outlet>
    <Label text="anotherTab outlet:"></Label>
    <router-outlet name="anotherTab"></router-outlet>
</StackLayout>

and the second version has:

<BottomNavigation>

    <!-- The bottom tab UI is created via TabStrip (the containier) and TabStripItem (for each tab)-->
    <TabStrip>
        <TabStripItem class="navigation__item">
            <Label text="Test"></Label>
        </TabStripItem>
        <TabStripItem class="navigation__item">
            <Label text="Another"></Label>
        </TabStripItem>
    </TabStrip>

    <!-- The number of TabContentItem components should corespond to the number of TabStripItem components -->
    <TabContentItem>
        <page-router-outlet name="testTab"></page-router-outlet>
    </TabContentItem>
    <TabContentItem>
        <page-router-outlet name="anotherTab"></page-router-outlet>
    </TabContentItem>

</BottomNavigation>

The home.routing.module has the following routes:

const routes: Routes = [
    {
        path: "",
        component: HomeComponent,
        children: [
            {
                path: '',
                component: TestComponent,
                outlet: 'testTab',
            },
            {
                path: '',
                component: AnotherComponent,
                outlet: 'anotherTab',
            },
        ]
    }
];

The first version works correctly (per angular logic) and loads the components for outlets. The second version doesn't load the components for outlets.

Expected behavior
I expect the second version work without any issue (be loading components to their outlets).
I know that I can navigate outlets programmatically and use custom paths for them, but I don't see any reason why this approach must not work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions