-
Notifications
You must be signed in to change notification settings - Fork 98
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
Using a Custom TabBar #42
Comments
+1 @Goktug I personally have a hack to achieve this, Overriding To make it all working, this custom tab bar should mimic the Expose these internal variables to public will do it, but a nicer way is - we can pass in our own ViewBuilder for tab bar and their associated views. |
Thanks for the advice @YuantongL, I was also trying to hack but couldn't reach the active tab index which is reactive. At least, if the library could provide this value we don't need to use |
@YuantongL I found a way without too much hacking. First, you need to hide the UITabBar globally.
And then you need to create an environment variable to pass active tab value to inside through subviews
we need to use the
Every time user changed the tab, we need to pass the new active tab index value. Therefore, we'll be using tab item creating
Almost everything is done, the only thing that we need to do is, handling the navigation when user click a specific custom tab button
Finally, I managed to create a custom tab bar using this structure without hacking the library. I hope I would be helpful to you as well |
@Goktug Thanks, that's a nice approach, definitely better then the hack! I made similar change to my project, the only difference is, instead of pass in environment variable, I made it through a binding.
Then in the coordinator, do the following
|
Your approach only relies on tab clicks, if you want to navigate through tabs via the router, your approach will fail. E.g. deep link. WDYT? |
Hi! Instead of a TabCoordinatable, a NavigationCoordinatable can also be used with your previous workaround @Goktug. Then you don't need to hide the tabbar globally - and instead of switching the tab you can use the |
@Goktug my approch doesn't have to depend on tab clicks if I simply remove the private
Anything that has a |
How
Hi! How you resolve problem if u need to hide tabView? Custom tab view always showing if u use this method ) |
Did you manage to solve this problem later on? If so, how did you do it? |
Hi @alvin-7 ! Yes, remove everything and create TabBar with UIKit :-) |
@2jumper3 Can you go into a bit more detail on how you removed the existing tab bar? I have a tab bar implementation I want to use that I'm trying to figure out the best way to implement. Thanks! |
this comment worked for me to implement a view that replaces the tabview with something custom |
first of all,set hide UITabBar in your app:
then:
my BottomNavigationBar:
|
In my project, I need to calculate the tab height. However, there is no way to access the existing TabBar in your library. If you can add the height value as an environment variable, would be nice. On the other hand, I am thinking that if you can add an ability to use Custom Tab Bar would be awesome.
What do you think? I'd like to hear your opinions
The text was updated successfully, but these errors were encountered: