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.

Unable to set active icon and label style in BottomNavigation.Action

See original GitHub issue

When using <BottomNavigation.Action />, the only style property working is container. How do I set the style properties of active and disabled?

<BottomNavigation.Action
              key="today"
              icon={<FontAwesome name='bell' size={25} />}
              label="Alerts"
              onPress={() => this.setState({ active: 'alert' })}
              style={{
                container:{
                  backgroundColor: 'red'
                },
                active:{
                  color: '#AC8E49',
                }
              }}
          />

The component rendered has a red background but the icon style is not colored.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:7

github_iconTop GitHub Comments

6reactions
ManishAhirecommented, Dec 11, 2018

I have some problem.

Code :-

<BottomNavigation.Action
          style={{
                active: {
                   color: "green"
                 }
            }}
            key="today"
            icon="today"
            label="Today"
            onPress={() => this.setState({ active: "today" })}
 />

Result :- screenshot 2018-12-11 at 6 31 09 pm

1reaction
dushyanttessactcommented, Aug 27, 2019

This works,

<BottomNavigation.Action
                    key="Movies"
                    icon={movieIcon}
                    style={{
                        icon: {color: this.state.activeBottomNavScreen === "Movies" ? "#fdbd32" : "#7ccced"},
                        label: {color: this.state.activeBottomNavScreen === "Movies" ? "#fdbd32" : "#7ccced"},
                    }}
                    label="Movies"
                    onPress={this.setBottomNavScreen.bind(this,"Movies")}
                />
Read more comments on GitHub >

github_iconTop Results From Across the Web

flutter - BottomNavigationBar // Cannot control item label color
This will change the color of label and icon both for unselected items. Example: Image. Unfortunately, unselectedLabelStyle property works for ...
Read more >
Bottom Navigation Title To Label - Flutter documentation
The BottomNavigationBarItem class has a title parameter, which is a Widget . This made it impossible for the BottomNavigationBar to show Tooltip widgets,...
Read more >
BottomNavigation · React Native Paper
Whether the shifting style is used, the active tab icon shifts up to show the label and the inactive tabs won't have a...
Read more >
Flutter - Custom Bottom Navigation Bar - GeeksforGeeks
You can name the variable as you wish. The pageIndex is to hold the index of your current page. Now define a final...
Read more >
BottomNavigationView - Android Developers
Each menu item title, icon and enabled state will be used for displaying bottom navigation bar items. Menu items can also be used...
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