Hello @wixadmin thank you for this great package, I have to make an unusual TabBar styling(especially the big button in center) but I don't know even if I can with this environment. Can you guide me through please?
you got the solution?
you may need implement react native lottie with navigator, it might be only supported by airbnb react navigation.
I dont need animation effect and i only want selected specific icon image.I tried like
{
label: 'HOME',
screen: 'Home',
icon: require('../img/ic_tabbar.png'),
selectedIcon: require('../img/ic_tabbar_on.png'),
title: 'HOME',
},
But it always take selected icon color is default tint.I did not get exact color.
@akjesto
on IOS, you need
tabsStyle: {
tabBarTextFontFamily: 'Avenir-Medium',
tabBarSelectedButtonColor: THEME_COLOR.color,
tabBarBackgroundColor: '#ffffff'
},
android syntax is slightly different:
appStyle: {
tabBarBackgroundColor: '#fff',
tabBarButtonColor: '#000',
navBarTextFontSize: 34,
forceTitlesDisplay: true,
tabFontFamily: 'Avenir-Medium',
tabBarSelectedButtonColor: THEME_COLOR.color,
}
The whole thing is something like:
Navigation.startTabBasedApp({
...tabs,
tabStyle: {
...
},
appStyle: {
...
}
});
Please reference the document for more details:
https://wix.github.io/react-native-navigation/#/
@jp928 Please go through the following code
const createTabs = () => {
let tabs = [
{
label: 'HOME',
screen: 'Home',
icon: require('../img/ic_tabbar_inici.png'),
selectedIcon: require('../img/ic_tabbar_inici_on.png'),
title: 'HOME',
},
{
label: 'LIST',
screen: 'List',
icon: require('../img/ic_tabbar_inici.png'),
selectedIcon: require('../img/ic_tabbar_inici_on.png'),
title: 'LIST',
}
]
return tabs;
}
Navigation.startTabBasedApp({
tabs: createTabs(),
tabsStyle: {
// tabBarButtonColor: '#ffffff',
tabBarTextFontFamily: 'Avenir-Medium',
tabBarSelectedButtonColor: '#ff00ff',
tabBarBackgroundColor: '#ffffff'
}
});
But output is like
But my ic_tabbar_inici_on.png is like the following and i want this image when i selected the tab.
I did not get exact tab icon when i loaded. I always get blue different colors on my tab icon selected.
The snippit u just attached would not return a tab object contains tabsStyle property. please double check.
'''javascript
const createTabs = () => {
const tabs ={ [
{
label: 'HOME',
screen: 'Home',
icon: require('../img/ic_tabbar_inici.png'),
selectedIcon: require('../img/ic_tabbar_inici_on.png'),
title: 'HOME',
},
{
label: 'LIST',
screen: 'List',
icon: require('../img/ic_tabbar_inici.png'),
selectedIcon: require('../img/ic_tabbar_inici_on.png'),
title: 'LIST',
}
],
tabsStyle: {
tabBarTextFontFamily: 'Avenir-Medium',
tabBarSelectedButtonColor: '#ffffff',
tabBarBackgroundColor: '#ffffff'
}};
return tabs;
}
'mm
@jp928 Please check my above comment.I updated it.
your code looks alright. but this library cannot change selectedIcon on Android. u can test it on IOS
@jp928 , Now i checked with it in iOS only
@akjesto Since your selecedIcon is very similar to the origin icon. plz advise the difference. your code should work as expected, maybe u could swipe your selectedIcon with an obvious change.
Sorry guys I've lost context. My original question is about the big button in the middle, is it possible to create by using this package?
I don't believe it currently is. @guyca any ideas regarding this?
The Android tabs are currently based on https://github.com/aurelhubert/ahbottomnavigation
I mean, you could create a single screen app and have your own implementation of this, however you're not going to have the bar persisted across screens or the "active" state tracked etc.
There's some thing you can change but its not what you are looking for . As @Ehesp says , it uses a third party library https://github.com/aurelhubert/ahbottomnavigation , but you cann't make change as it its compiled version that have .class extension instead of java .
But one thing you can do is clone the package from github and place in the main/src/com directory of react-native navigation and add your custom styles on it .
Hi guys and @wixadmin,
Is there a way to have an option to customise active background color on selected tab (not only selected icon) ?
To achieve following effect (yellow active background color):
Thanks.
No , its not implemented yet as the navigation follows android Ui guidelines . Only underline color can be customized. However , of you have knowledge on java , you can tweak in in the native code.
Thanks @PARAGJYOTI
@jp928 Why is changing the selected tab icon not supported on Android when Facebook themselves do it?
Any news on this ? I tried react-navigation and react-native-navigation and I think I might choose react-navigation if I can't have a custom component as a tab bar or header bar.
Has anyone got the larger middle button to work ? a solution would be much appreciated ...
@fuatsengul do you have any solution for larger middle button ?
@fuatsengul Have you got the solution for this?
I removed react-native-navigation and created a custom component who's absolute in the bottom.
@luxferoo Problem with this approach is when you push any component bottom bar is gone, you need to integrate this inside each component registered as screen!
@vigneshprabhu20 you can perform that creating a HOC and put the bar in one place
The upcoming Android design support lib v28 will have an interesting approach to the Bottom app bar where you can attach the FAB to the action bar which is kind of what you want:
But now I know the underneath android support using a 3rd party lib, so it's very hard to change... Still wanna mention it just in case.
The same issue , i dont need animation effect now
only different style for center icon.
I just want to use different icons based on whether a tab is selected or not. is that possible right now? (i'm using v2)
@cshen4 yes you can with 'selectedIcon' attribute
Navigation.setRoot({
root: {
bottomTabs: {
children: [
{
stack: {
children: [
{
component: {
name: 'ServiceInstance',
options: {
bottomTab: {
title: 'Service',
icon: require('../images/app_icon/Service_outline.png'),
selectedIcon: require('../images/app_icon/Service_full.png')
}
}
}
}
]
}
},
{
stack: {
children: [
{
component: {
name: 'Contacts',
options: {
bottomTab: {
title: 'Contacts',
icon: require('../images/app_icon/Contacts_outline.png'),
selectedIcon: require('../images/app_icon/Contacts_full.png')
}
}
}
}
]
}
},
{
stack: {
children: [
{
component: {
name: 'Me',
options: {
bottomTab: {
title: 'Me',
icon: require('../images/app_icon/Me_outline.png'),
selectedIcon: require('../images/app_icon/Me_full.png')
}
}
}
}
]
}
}
],
options: {
backgroundColor: 'white'
// tabColor: '#777777',
// selectedTabColor: '#2979FF'
// tabBarDisableSelectedIconTint: true
}
}
}
});
@luxferoo this is my code right now, the selectedIcon doesn't seem to work... Am I putting it in the wrong place?
@cshen4 I don't think it's a wix/react-native-navigation configuration , look at mine :
Navigation.startTabBasedApp({
tabs: [
{
screen: 'pipo.UserInfo',
label: 'Account',
title: 'Account',
icon: sources[0],
selectedIcon: sources[3],
navigatorStyle: {
navBarButtonColor: 'black',
//navBarTextColor: mainBlue
}
}
]
})
I am also looking to have a bigger central button in the navigation bar. This issue seem to be related/duplicated by wix/react-native-navigation#2126.
Best looking option so far : https://itnext.io/react-native-tab-bar-is-customizable-c3c37dcf711f.
I'm still looking for other options and will try the best one.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest version and report back. Thank you for your contributions.
The issue has been closed for inactivity.
Yeah sure ... nice job to close the issue because of "inactivity" ... not from us ... from the devs ! 🤦♂️
@luxferoo the configuration posted by @cshen4 is for v2 of this package which is far more flexible.
Most helpful comment
The upcoming Android design support lib v28 will have an interesting approach to the Bottom app bar where you can attach the FAB to the action bar which is kind of what you want:
But now I know the underneath android support using a 3rd party lib, so it's very hard to change... Still wanna mention it just in case.