-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tab bar background style properties not applied when tabBarPosition is 'top' #2888
Comments
I have been able to reproduce this in an empty project using the latest version of React Native Router Flux with a simple Tabs component. I have also been unable to reproduce this on a simple project using vanilla React Navigation, so it appears to me at the moment that this is a bug with Router Flux. I've created a Proof Of Concept repo here where you can reproduce this bug: https://github.com/kylethebaker/router-flux-tabs-poc You can run both the Router Flux and React Navigation applications, changing the You will find that Router Flux doesn't respect the |
I've found a work around for this problem, though I'm not really sure at what layer of the stack the bug occurs on. It looks like Router Flux looks at the React Navigation on the other hand uses a default As a work around to get styling to apply to the top tabs I need to pass: So I'm not sure if React Navigation should be basing it's default tab bar (either I'm thinking too the issue may be due to the fact that I'm going to open up a companion issue on React Navigation concerning this and see if I can get clarification. |
Please try to reproduce it with Example project and latest version 4.0.0-beta.40. Feel free to open if the issue still exists |
Thanks @kylethebaker for demystifying the logic :) My goal was to make a top bar with same background color for both inactive and active tabs and an indicator bottom line for active tab. After some time reading issues here and react-navigation I came up below solution. Hopefully this is helpful for others who are looking solution for the same problem. import { Router, Stack, Scene, Tabs } from 'react-native-router-flux';
import { TabBar } from 'react-native-tab-view';
<Tabs
key="my_tabs"
navBar={MyContainer}
tabBarPosition="top"
labelStyle={{
fontSize: 14,
fontWeight: "bold",
color: "white"
}}
indicatorStyle={{
backgroundColor: "white",
height: 4
}}
jumpToIndex={() => {/* this needs to be declared to avoid warning...*/ }}
tabBarComponent={(props) =>
<TabBar {...props}
style={{
backgroundColor: "red"
}}
/>
}
>
<Scene
title="One"
key="one"
hideNavBar={true}
component={OneContainer} />
<Scene
title="Two"
key="two"
hideNavBar={true}
component={TwoContainer} />
<Scene
title="Three"
key="three"
hideNavBar={true}
component={ThreeContainer} />
</Tabs> Versions: |
Version
Expected behaviour
When the
tabBarPosition
is set to 'top,activeBackgroundColor
andinactiveBackgroundColor
should be applied, just as they are whentabBarPosition
is set to 'bottom'.Actual behaviour
The background colors are the default blue when the tab bar is on the top, but the tint colors still apply.
Steps to reproduce
The text was updated successfully, but these errors were encountered: