This repository has been archived by the owner on May 1, 2024. It is now read-only.
[Bug] [iOS] NavigationBar resetting TextColor to black at every change of BarBackgroundColor #9767
Labels
a/navbar
i/high
Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often
i/regression
in-progress
This issue has an associated pull request that may resolve it!
p/iOS 🍎
t/bug 🐛
Projects
Milestone
Description
Well, basically the PropertyChanged of BarBackgroundColor resets the NavigationBar's Appearance instead of modifying the current one. You can see this happening at this line:
Xamarin.Forms/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs
Line 631 in 6a23b84
If this line is changed to:
var navigationBarAppearance = NavigationBar.StandardAppearance;
The bug is gone.
I can't provide any repro projects as I'm experiencing this issue on a commercial app and couldn't reproduce the issue on a new project, but just looking at the line I linked it's possible to understand that the code should be like I said if nothing is meant to be overwritten.
I tested this modification with the said commercial app and it's working. 🙂
Basic Information
Workaround
On a new NavigationRenderer's PropertyChanged, copy the code of
UpdateBarBackgroundColor
(Xamarin.Forms/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs
Line 618 in 6a23b84
new UINavigationBarAppearance()
toNavigationBar.StandardAppearance
as I said in the description.The text was updated successfully, but these errors were encountered: