question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BottomNavigation] [iOS] Having selected index in XML does not change correctly styles

See original GitHub issue

Make sure to check the demo app(s) for sample usage

Make sure to check the existing issues in this repository

If the demo apps cannot help and there is no issue for your problem, tell us about it

Having a default selected index defined in the XML does not change correctly the styles of the tabs, although the tab is loaded correctly. Happens only on iOS, on android works perfectly fine.

Which platform(s) does your issue occur on?

  • iOS
  • 14.4
  • emulator

Please, provide the following version numbers that your issue occurs with:

  • CLI: 8.0.1
  • Cross-platform modules: 8.0
  • Runtime(s): 8.0
  • Plugin(s): (look for the version numbers in the package.json file of your project and paste your dependencies and devDependencies here)

Please, tell us how to recreate the issue in as much detail as possible.

Describe the steps to reproduce it.

Is there any code involved?

Sample XML:

<Page xmlns="http://schemas.nativescript.org/tns.xsd" 
xmlns:mdt="@nativescript-community/ui-material-bottom-navigation"
navigatingTo="navigatingTo">

    <ActionBar title="My App" icon="" />

    <GridLayout>
        <mdt:BottomNavigation  
            id="view-bottom-nav"
            style="font-size: 15;" 
            selectedIndex="1">
            
            <!-- The bottom tab UI is created via TabStrip (the containier) and TabStripItem (for each tab)-->
            <mdt:TabStrip iosIconRenderingMode="alwaysOriginal">
                <mdt:TabStripItem class="tab" title="Client"  style="color:#fefefe;"/>
                <mdt:TabStripItem class="tab" title="Tasks" style="color:#fefefe;"/> 
            </mdt:TabStrip>
            <mdt:TabContentItem>
                <Label text="Tab 1" />
            </mdt:TabContentItem>
            <mdt:TabContentItem>
                <Label text="Tab 2" />
            </mdt:TabContentItem>

        </mdt:BottomNavigation>
    </GridLayout>
</Page>

CSS:

.tab {
    background-color: blue;
    color: white;
}

.tab:active {
    background-color: red;
    color: white;
} 

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
farfromrefugcommented, Apr 8, 2021

@PeterStaev fixed in 5.2.19

0reactions
PeterStaevcommented, Apr 8, 2021

@farfromrefug thanks for the fast fix, works as expected now!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Set selected item in Android BottomNavigationView
From API 25.3.0 it was introduced the method setSelectedItemId(int id) which lets you mark an item as selected as if it was tapped....
Read more >
Bottom navigation - Material Design
Bottom navigation bars allow movement between primary destinations in an app. ... Note:BottomNavigationView does not support more than 5 menu items.
Read more >
Bottom Navigation - Material Components for Android
BottomNavigationView creates bottom navigation bars, making it easy to explore and switch between top-level content views with a single tap.
Read more >
Dynamic change of CSS class for TabStrip not working (Tabs ...
The issue is present for both Android and iOS but has different behavior. To Reproduce Use this Playground demo or the following structure:...
Read more >
Styling - NativeScript Docs
How to use Cascading Style Sheets (CSS) in NativeScript to change the ... will automatically import the common styles and choose the correct...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found