Replies: 1 comment 2 replies
-
@PureWeen @jsuarezruiz |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description
In Xamarin & Maui Shell we can set the following property
Shell.SetTabBarIsVisible(this, true);
which will show and hide theTabBar
when using Shell.This feature is Shell only and there is no simple way to perform the same functionality using
TabbedPage
. The Shell TabBar andTabbedPage
will render the same native elements onscreen so it makes sense to back port this Shell functionality toTabbedPage
.I have looked into creating platform handlers for this functionality, it is easily achievable on iOS however on Android it's not possible without an unbelievably cursed reflection based approach since the android
TabbedPage
uses a mapper that uses an internal class to render the view. It's incredibly hard to actually get access to the BottomNavigationView in order to set it's visibility (unless anyone has any ideas...).Due to how incredibly hard the handlers would be to implement and based on the precedence that Shell has it (Maui should be accessible to non Shell navigation), I believe porting this feature to
TabbedPage
out of the box would be the best approach in this situation.As long as the handlers & renderers stay the same, I would be happy to PR this change.
Public API Changes
Introduce new attached property for
TabbedPage
:Usage:
TabbedPage.SetTabBarIsVisible(this, false); // C#
TabbedPage.SetTabBarIsVisible(this, true); // C#
TabbedPage.SetTabBarIsVisible="False" <!-- XAML -->
TabbedPage.SetTabBarIsVisible="True" <!-- XAML -->
Mapper?
I believe this could be a candidate for a mapper property however looking at the implementations of this specific control, it's probably better to use attached properties. iOS doesn't even use a mapper, it still uses a custom renderer.
Intended Use-Case
Why this feature? Shell has it and it allows developers who don't want to use shell (I much prefer Prism) equal flexibility with customisation in their apps. It gives us the flexibility to use whatever MVVM framework we like and be capable of achieving the same UI results either way.
Workaround
If you want to hide the tab bar today for android and ios, here are the handlers to do it, we're going to piggyback off the shell attached property too!
iOS
Register handler on
ContentPage
:Android
Register handler on the tabbed page:
Beta Was this translation helpful? Give feedback.
All reactions