Bottom Navigation active background visible for multiple screens.
See original GitHub issueCurrent behaviour
When I click on a different screen I get Navigated to that page and it’s background becomes highlighted, however, the background of the previous tab is still highlighted.
Expected behaviour
The background of non active tabs should not be highlighted.
Code sample
import React from 'react';
import {createMaterialBottomTabNavigator} from '@react-navigation/material-bottom-tabs';
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
import {Dashboard} from '../pages/Dashboard';
import {Statistics} from '../pages/Statistics';
import {Settings} from '../pages/Settings';
const Tab = createMaterialBottomTabNavigator();
export const NavigationBar = () => {
return (
<Tab.Navigator initialRouteName="Home">
<Tab.Screen
name="Home"
component={Dashboard}
options={{
tabBarLabel: 'Home',
tabBarIcon: ({color}) => (
<MaterialIcons name="home" color={color} size={26} />
),
}}
/>
<Tab.Screen
name="Statistics"
component={Statistics}
options={{
tabBarLabel: 'Statistics',
tabBarIcon: ({color}) => (
<MaterialIcons name="bar-chart" color={color} size={26} />
),
}}
/>
<Tab.Screen
name="Settings"
component={Settings}
options={{
tabBarLabel: 'Settings',
tabBarIcon: ({color}) => (
<MaterialIcons name="settings" color={color} size={26} />
),
}}
/>
</Tab.Navigator>
);
};
Screenshots (if applicable)
What have you tried
I have tried testing the code given in snack, but it didn’t worked
Your Environment
software | version |
---|---|
ios or android | ios 16.0 |
react-native | v0.70.0 |
react-native-paper | v5.0.0-rc.5 |
node | v16.17.0 |
npm or yarn | v1.22.19 |
expo sdk | Using native cli |
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Keep the bottom navigation bar in every screens flutter
Create a stateful widget to hold the list of all possible views, current index of the view to be displayed and the bottom...
Read more >Bottom Tabs Navigator | React Navigation
A simple tab bar on the bottom of the screen that lets you switch between different routes. Routes are lazily initialized -- their...
Read more >BottomNavigationBar class - material library - Dart API
A material widget that's displayed at the bottom of an app for selecting among a small number of views, typically between three and...
Read more >Bottom navigation - Material Design
Bottom navigation bars display three to five destinations at the bottom of a screen. Each destination is represented by an icon and an...
Read more >Bottom Tab Navigator - Thunkable Docs
Active Tint Color. Select a text color for the tab currently in use. Color. Active Background Color ; Navigation Button Name. Text that...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Okay, I will create one.
I hope it will fix your problem.
You just need to add a “tabBarColor” props in the “Tab.Screen” component. This will dynamically, change the background color of the selected Bottom Tab item.
By the way, which “@react-navigation/material-bottom-tabs” version are you using in your application?