Skip to content

react-navigation/material-bottom-tabs set background through theme #1748

@lasharela

Description

@lasharela

My react native app is wrapped by PaperProvider and for most components, it works.

import {DefaultTheme} from 'react-native-paper';

const theme = {
  ...DefaultTheme,
  roundness: 2,
  colors: {
    ...DefaultTheme.colors,
    primary: '#FF2968',
    accent: '#54FFF3',
  },
};

export default theme;

That's how my theme.js looks like and

image

Everything looks fine except react-navigation/material-bottom-tabs

import React from 'react';
import {createMaterialBottomTabNavigator} from '@react-navigation/material-bottom-tabs';
import {Icon} from '@components';

import ScreenHome from '@screens/ScreenHome';
import ScreenSettings from '@screens/ScreenSettings';

const Tab = createMaterialBottomTabNavigator();
const TabNavigation = () => {
  return (
    <Tab.Navigator
      shifting={true}
      sceneAnimationEnabled={false}
      initialRouteName="Feed"
      activeColor="#fff">
      <Tab.Screen
        name="Home"
        component={ScreenHome}
        options={{
          activeColor: '#ff0',
          tabBarIcon: ({color}) => (
            <Icon name="activity" type="Feather" size={30} color={color} />
          ),
        }}
      />
      <Tab.Screen
        name="Settings"
        component={ScreenSettings}
        options={{
          tabBarIcon: 'message-text-outline',
        }}
      />
    </Tab.Navigator>
  );
};

export default TabNavigation;

Based on documentation:
By default Bottom navigation uses primary color as a background, in dark theme with adaptive mode it will use surface colour instead. See Dark Theme for more informations

But it's blue anyway.

What I'm doing wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions