react-native-collapsible-tab-view icon indicating copy to clipboard operation
react-native-collapsible-tab-view copied to clipboard

LabelStyle TabBar

Open DaylAppReactNative opened this issue 2 years ago • 6 comments

Hi,

I'm trying to change the color of the TabBar text, I tried different styles props including this one :

renderTabBar={props => <MaterialTabBar {...props} labelStyle={{color:"white"}} />}

but for some reason it changes back to black as soon as it finished rendering.

Any advice?

Thank you :)

DaylAppReactNative avatar Aug 02 '22 13:08 DaylAppReactNative

hi, I too not able to change any style for tab bar item used all style properties...

TabBarComponent={(props) => <MaterialTabBar {...props} scrollEnabled={true} activeColor="red" inactiveColor="yellow" inactiveOpacity={0.3} labelStyle={{fontSize: 6}} tabStyle={{fontSize: 6}} style={{fontSize: 6}} />}

dearlk avatar Aug 07 '22 10:08 dearlk

Did you guys manage to resolve this? I'm having the same issues right now. @dearlk @DaylAppReactNative

hazirmagron avatar Feb 18 '23 14:02 hazirmagron

I'm having this issue. Is this repo maintained?

bpeck81 avatar Apr 11 '23 20:04 bpeck81

Cannot look into this without a repro.

Try memoizing renderTabBar. The following works in a project I'm working on:

  const renderTabBar = useCallback(
    (props: TabBarProps) => {
      return (
        <MaterialTabBar
          {...props}
          style={tabBarStyle}
          labelStyle={labelStyle}
          indicatorStyle={indicatorStyle}
          activeColor={colors.text}
          inactiveColor={colors.text}
          scrollEnabled
          keepActiveTabCentered
        />
      );
    },
    [colors.text, indicatorStyle, labelStyle, tabBarStyle],
  );

andreialecu avatar Apr 12 '23 08:04 andreialecu

This is still an issue for me, even when using memoization as you suggest @andreialecu Here's what I'm doing:

renderTabBar={(props: any) => <MaterialTabBar {...props}
              labelStyle={{ color: 'pink' }}
/>}

The color does not stay pink when switching tabs, it just goes back to the default black color

ipoogleduck avatar Mar 27 '24 08:03 ipoogleduck

Ah I see, activeColor and inactiveColor need to be overridden on the MaterialTabBar

ipoogleduck avatar Mar 27 '24 08:03 ipoogleduck