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
activeTintColor changing text color but not icon color #1781
Comments
For the icon to change color, you have to set the color to the icon yourself, since the icon is under your own control. How did you define the If you look in the documentation you'll see you have to pass the |
Ah thank you, don't know how I missed that. |
@steve-else Is it working to you? I passed the |
@manuTro It works for me: The tab icon and label is original gray in IOS, it turns into blue when active. |
@whitefusion Hey, I'm trying to implement your example. but it didn't work for me. What can be wrong? Here is my code:
|
@Luckygirlllll you need to use the |
@whitefusion your code work perfectly! |
am using ionicon but active is not working for me |
@embashgit you have to this works perfectly fine. As mattijauhainainen has mentioned it is important to use the tintColor attribute, not focused |
I have this code below, and I am gettin the icon the color I want but the tabBarOptions does not change the tabBarLabel which is now blue and the icon turquoise
|
@eleallegue work for you?
|
The icon changes to the color I want, becuase I created the class TabBarIcon which insides changes the color if it is active. The thing is that the text of the option, the tabbarlabel doesn't change as well as the other, and so it stays blue... |
This is how I did it ..you can try it navigationOptions: ({ navigation }) => ({
Then, where u need to use it you are to try: ID: {
|
Or this for icon... tabBarIcon: ({tintColor})=> ( |
None of those worked for me... I am still having the same issue, and I don't want to remove the label, but as the label is blue and my icon is turquoise (which I want), I think I have no choice... I have run out of options for this issue |
How about using my custom image icon , ca we change the activeTintcolor then ? |
I tried that too, but it does not work... (sorry for the late response, github just did not notify me). |
The @eleallegue I ended up having to do this for it to work:
|
@whitefusion thank you it's works. |
U saved the day !! working flawlessly |
Instead of using
|
how can i switch images on active and inactive? |
@Rajdeepc If you mean changing the icon, you can pass in a React element or function that knows when it's focused. Can read about it here. ex:
|
Thanks @steve-else yo save me from this problem |
I struggled with trying to figure out the solution with React Navigation 5.., now after using color prop instead of tintColor it wors fine. |
was struggling for hours ... thanks a ton |
Facing the same problem - attempted this solution but my icons are always stuck at the inactiveTintColor... :( Will update if I can get it working. <Tab.Navigator tabBarOptions={{
activeTintColor: '#ffffff',
inactiveTintColor: '#7FC0C4',
style: {
backgroundColor: '#00818A',
},
}}>
<Tab.Screen
name="Sleep"
component={DiaryScreen}
options={{
tabBarLabel: 'Sleep',
tabBarIcon: ({ color }) => (
<TabBarIcon
color={color}
name={Platform.OS === 'ios' ? 'ios-journal' : 'md-journal'} />
),
}} /> |
UPDATE: Got it working by adding the focused prop back. Code below: <Tab.Navigator tabBarOptions={{
activeTintColor: '#ffffff',
inactiveTintColor: '#7FC0C4',
style: {
backgroundColor: '#00818A',
},
}}>
<Tab.Screen
name="Sleep"
component={DiaryScreen}
options={{
tabBarLabel: 'Sleep',
tabBarIcon: ({ color, focused }) => (
<TabBarIcon
focused={focused}
color={color}
name={Platform.OS === 'ios' ? 'ios-journal' : 'md-journal'} />
),
}} /> |
Thanks dude! Was struggling for a while |
Slight tangent to the original question - but if it helps anyone else, I am configuring According to the React Navigation 5 docs, Original code (not working):
Corrected (tint works for both text and icon):
|
U are god |
"react-navigation-tabs": "^2.10.1", We have to specify a key cause the variable "color" is an object. For example:
will return this error: Since color is an object, we need to replace hope can help someone. |
ProfileStack.navigationOptions = { |
Hey! This issue is closed and isn't watched by the core team. You are welcome to discuss the issue with others in this thread, but if you think this issue is still valid and needs to be tracked, please open a new issue with a repro. |
Icons are not changing color when active it's all black
|
Hey! This issue is closed and isn't watched by the core team. You are welcome to discuss the issue with others in this thread, but if you think this issue is still valid and needs to be tracked, please open a new issue with a repro. |
Hi! In case somebody comes here in search of a drawer navigator solution for setting icon tint color when a certain route in a drawer navigator is active, here is how I solved this issue: |
Hey! This issue is closed and isn't watched by the core team. You are welcome to discuss the issue with others in this thread, but if you think this issue is still valid and needs to be tracked, please open a new issue with a repro. |
Try out this |
Hey! This issue is closed and isn't watched by the core team. You are welcome to discuss the issue with others in this thread, but if you think this issue is still valid and needs to be tracked, please open a new issue with a repro. |
Having an issue with activeTintColor on iOS. Current code for tabBarOptions:
This doesn't let me change the color of the icons when the tab is active. As you can see I have showLabel disabled because I just want to show icons and not text. However when I have showLabel enabled, it does change the color of the text correctly, but it still does not change the color of the icon. Isn't activeTintColor supposed to change both? Is anyone else having this issue?
The text was updated successfully, but these errors were encountered: