xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.63k stars 1.88k forks source link

[iOS] HidesBottomBarWhenPushed does nothing #1887

Closed Paul-Brenner-Tangoe closed 2 years ago

Paul-Brenner-Tangoe commented 6 years ago

Bug report best practices: https://github.com/xamarin/Xamarin.Forms/wiki/Submitting-Issues

Description

Migrating https://bugzilla.xamarin.com/show_bug.cgi?id=56072 here

I have a tabbed page with a page and a page in a navigation controller. On the page with the navigation controller, there is a button that will do a push to another page. When the page is pushed I want to remove the tab bar. And when the user hits back, I want the tab bar to reappear. The property HidesBottomBarWhenPushed on a UIViewController is supposed to do just that.

Setting that property in a Xamarin.ios project works perfectly, does exactly what it is supposed to do.

Setting the property in a custom renderer in a Xamarin.forms project does nothing, the tab bar won't disappear when the page is pushed.

Steps to Reproduce

  1. Run project, go to the second tab
  2. Press the button
  3. Note that the tab bar is still shown

Expected Behavior

The tabbar disappears when you use the button to navigate

Actual Behavior

The tabbar does not disappear

Basic Information

Reproduction Link

https://www.dropbox.com/s/0h9az4ybpag12tm/hidesbottombarwhenpushedxam.zip?dl=0 The attached zip has the Xamarin.ios project as well as the Xamarin forms project.

rmarinho commented 6 years ago

The way we wrap the Page inside another ViewController when pushing on UIViewControlelr will not allow this to work.

This is could be done with a platform specific for iOS, i will set this as a enhancememnt

adrianknight89 commented 6 years ago

@rmarinho I suppose you mean updating ParentingViewController's property before pushing the page on the stack?

rmarinho commented 6 years ago

yeah that was the wrapper I was referring , but remember this is internal, we could change that ..

adrianknight89 commented 6 years ago

What did you mean by "we could change that"? You mean we could get rid of the wrapper, make it non-internal, or something else?

mttbernardini commented 6 years ago

The way we wrap the Page inside another ViewController when pushing on UIViewControlelr will not allow this to work.

Thank you @rmarinho for this hint, as a workaround I'm now using a custom renderer (in Xamarin.Forms) with:

public override void DidMoveToParentViewController(UIViewController parent)
{
    base.DidMoveToParentViewController(parent);

    // hide bottom tabbar
    parent.HidesBottomBarWhenPushed = true;
}

And it's working, however it leaves an extra transparent space at the bottom (with the height of the hidden tabbar) which I don't know how to remove. I think it might be caused by the child view not scaling up with the wrapper.

I'm neither a Xamarin nor an iOS dev expert, do you have any suggestions to resolve it?

Sorry for bothering and thanks in advance.

jfversluis commented 2 years ago

Thanks for this suggestion! As Xamarin.Forms is now in maintenance mode, this will not happen anymore for Xamarin.Forms. We're only adding bugfixes and stability fixes.

If this is still important to you, make sure to check the .NET MAUI repo and see if it's already on the roadmap. If not, feel free to open a discussion to discuss a change first or open an issue with a detailed feature request. Thanks!