Visitar URL original
Badge property for TabStripItem in BottomNavigation · Issue #8901 · NativeScript/NativeScript · GitHub
The Wayback Machine - https://web.archive.org/web/20260624120658/https://github.com/NativeScript/NativeScript/issues/8901
Skip to content

Badge property for TabStripItem in BottomNavigation #8901

Description

@tdhman

Is your feature request related to a problem? Please describe.
Hello,

I recently use the component BottomNavigation for my application and try to add a badge icon to the tabbar items but this component only allows to add 1 Label + 1 Image in TabStripItem component. When I try to add a custom layout, e.g. StackLayout, in order to add another Label to create a badge icon, the custom layout is not displayed. There is no way to add a 3rd component inside the tabstripitem?

<TabStripItem class="navigation__item">
   <StackLayout>
       <Label text="Home" />
       <Label text="10" class="badge-icon" />
   </StackLayout>
    <Image src.decode="font://&#xe021;" class="fas t-36"></Image>
</TabStripItem>

For iOS, this component uses UITabController which has a badge property in order to show a badge count. So I think it's possible to support this feature in the component BottomNavigation itself.
I have tried the following code to show the badge with the BottomNavigation component and it works.

<BottomNavigation id="bottomTabNav">
<!-- TODO  -->
</BottomNavigation>

bottomTabNav.ios.tabBar.items[0].badgeValue = '10 '; // show the badge on tab item

However, for Android, I don't found anyway to add a badge count.

Describe the solution you'd like
For example, we can add a badge property directly to the component the TabStripItem:

<TabStripItem class="navigation__item" badge="10">
    <Label text="Home"></Label>
    <Image src.decode="font://&#xe021;" class="fas t-36"></Image>
</TabStripItem>

Is there any plan to add the badge feature for the component BottomNavigation?

Describe alternatives you've considered
For iOS, we can badge value directly with the code:

bottomTabNav.ios.tabBar.items[0].badgeValue = '10 '; // show the badge on tab item

For android, is it possible to add badge with code?

IMG_0263

Thank you for any help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions