Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[iOS] Fix Shell NavigationBar and TabBar color issues #14649

Merged
merged 9 commits into from
Oct 7, 2021
Merged

Conversation

jsuarezruiz
Copy link
Contributor

@jsuarezruiz jsuarezruiz commented Sep 23, 2021

Description of Change

Fix Shell NavigationBar and TabBar color issues on iOS 15.

fix-colors-ios15

Issues Resolved

API Changes

None

Platforms Affected

  • iOS

Behavioral/Visual Changes

None

Before/After Screenshots

Not applicable

Testing Procedure

PR Checklist

  • Targets the correct branch
  • Tests are passing (or failures are unrelated)

@jfversluis
Copy link
Member

Got some build errors here @jsuarezruiz

@jsuarezruiz
Copy link
Contributor Author

@rmarinho Could we take a look to the build together?

@jfversluis jfversluis added this to Issues in Progress in 5.0.0 SR6 (Planning) - Target Date Oct. 13th via automation Oct 2, 2021
@jfversluis jfversluis moved this from Issues in Progress to PR Build/Test Failures in 5.0.0 SR6 (Planning) - Target Date Oct. 13th Oct 2, 2021
@jfversluis
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ianvink
Copy link

ianvink commented Oct 6, 2021

Shell seems fine. Please push asap!

@jfversluis jfversluis moved this from PR Build/Test Failures to PR Needs Review in 5.0.0 SR6 (Planning) - Target Date Oct. 13th Oct 7, 2021
@jsuarezruiz
Copy link
Contributor Author

Added changes to fix also: #14679

@jsuarezruiz jsuarezruiz marked this pull request as ready for review October 7, 2021 11:44
var navigationBarAppearance = new UINavigationBarAppearance();
navigationBarAppearance.ConfigureWithOpaqueBackground();

navBar.Translucent = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In line with the one for tab bar... Not sure about this one?

@michaelstonis
Copy link

I believe that this issue is partially fixed. The tab coloring updates on iPhone devices, but not on iPads. In this example, the iPhone has a green foreground text color, but the iPad retains the standard blue color.

This was tested against Xamarin.Forms 5.0.0.2196.

image
image

Sample Shell implementation used for testing. This should match up pretty closely to the unit tests.

using System;
using Xamarin.Forms;

namespace TestShellTab
{
    public class TestShell : Shell
    {
        public TestShell()
        {
            Shell.SetTabBarBackgroundColor(this, Color.Bisque);
            Shell.SetTabBarForegroundColor(this, Color.Yellow);
            Shell.SetTabBarTitleColor(this, Color.LawnGreen);

            var page1 =
                new ContentPage
                {
                    BackgroundColor = Color.Fuchsia,
                };

            var page2 =
                new ContentPage
                {
                    BackgroundColor = Color.CornflowerBlue,
                };
                        

            this.Items.Add(
                new TabBar
                {
                    Items =
                    {
                        new ShellSection
                        {
                            Title = "Page 1",
                            Items =
                            {
                                new ShellContent
                                {
                                    Content = page1,
                                },
                            }
                        },
                        new ShellSection
                        {
                            Title = "Page 2",
                            Items =
                            {
                                new ShellContent
                                {
                                    Content = page2,
                                },
                            }
                        },
                    }
                });
        }
    }
}

@jfversluis
Copy link
Member

@michaelstonis Yep already fixed in #14775

@michaelstonis
Copy link

Awesome. I had missed this issue. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.