-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Bug] iOS Translucent no longer works with UIAppearance #11138
Comments
@pauldipietro @samhouts Hi XF Team, This is on our priority list. Not quite critical because it is cosmetic. But it used to work on our previous version, and now it no longer works. So seems like an obvious backwards step in the app. |
@davidortinau @pwillies thanks for bringing this to our attention! So there's a few different things going on here and I've spent the past week with the help of @rmarinho getting to the bottom of this :) NavBar Changes introduced in iOS 13 [assembly: ExportRenderer(typeof(Issue11138NavigationPage), typeof(_11138CustomRenderer))]
namespace Xamarin.Forms.ControlGallery.iOS.CustomRenderers
{
public class _11138CustomRenderer : NavigationRenderer
{
public override void ViewDidLoad()
{
base.ViewDidLoad();
UINavigationBar.Appearance.SetBackgroundImage(new UIImage(), UIBarMetrics.Default);
UINavigationBar.Appearance.ShadowImage = new UIImage();
UINavigationBar.Appearance.BackgroundColor = UIColor.Clear;
UINavigationBar.Appearance.Translucent = true;
if (UIDevice.CurrentDevice.CheckSystemVersion(13, 0))
{
var navigationBarAppearance = NavigationBar.StandardAppearance;
navigationBarAppearance.ConfigureWithTransparentBackground();
SetAppearanceOnNavigationBar(navigationBarAppearance);
}
}
void SetAppearanceOnNavigationBar(UINavigationBarAppearance navigationBarAppearance)
{
NavigationBar.CompactAppearance = navigationBarAppearance;
NavigationBar.StandardAppearance = navigationBarAppearance;
NavigationBar.ScrollEdgeAppearance = navigationBarAppearance;
}
}
} Transparent vs. Translucent Therefore, the IsNavigationBarTranslucent property you set Another thing to note is that when the IsNavigationBarTranslucent property is set, it should be set on the NavigationPage (not the ContentPage), which you can also see in the docs linked above. Hope all this helps!!! Let me know if you have any questions, or if you think I might be misunderstanding something. I'm also continuing to explore some of the nuances of translucency, especially with the changes that were introduced in iOS13. |
Hi! I also have an issue where nav bar transparency does not work for iOS (but works in Android). My usage is slightly different as the custom In case it helps, I have the following version info: The custom NavigationPage instance that needs transparency has Since the navigation pages are created via CS, I do not have Is there something else I'm missing? My original custom renderer is pretty much the same as what @davidortinau originally posted and was based on this post from 2018. Any tips/pointers would be appreciated! |
Following this thread as well. |
Description
When setting the NavBar translucent, and setting the UIAppearance to make it clear, the bar used to be completely transparent. Now it isn't.
The bar was transparent in 4.3, but it is no longer in 4.6 or 4.7 (from my tests).
Here is a series of images from different versions, no negative margins to pull the content (ListView) under the bar tho. The changes to the nav bar appearance are obvious...not sure what has been doing on, but things are changing that much is clear (pun intended).
4.3.0
4.4.0
4.5.0
4.7.0
Here are images showing the the bar is transparent under 4.3 and not under 4.7.
4.3.0 Grid with negative margin
4.7.0 Grid with negative margin
CustomNavigationRenderer:
Expected Behavior
If just setting the iOS translucent property, the bar should be partially transparent and scrollable content should appear behind it.
Setting customer UIAppearance so the bar is completely transparent should still work, or some other method to achieve this should be made available in Forms (#1698).
Basic Information
Reproduction Link
repro_4.7.0.zip
The text was updated successfully, but these errors were encountered: