Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ protected virtual void SetAppearance(ShellAppearance appearance)
return;
}

if (_bottomView.Background is ColorDrawable background && appearance is IShellAppearanceElement apperanceElement)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Typo error: appearanceElement

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Typo error: appearanceElement

I have modified the code.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could include a comment here? Something like: "Apply background color from appearance, fallback to default if unavailable"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Could include a comment here? Something like: "Apply background color from appearance, fallback to default if unavailable"

I have added comments now.

{
background.Color = apperanceElement.EffectiveTabBarBackgroundColor?.ToPlatform() ?? ShellRenderer.DefaultBottomNavigationViewBackgroundColor.ToPlatform();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The build is failing at this point:

/Users/builder/azdo/_work/2/s/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellItemRenderer.cs(146,89): error CS0103: The name 'ShellRenderer' does not exist in the current context [/Users/builder/azdo/_work/2/s/src/Controls/src/Core/Controls.Core.csproj::TargetFramework=net9.0-android35.0]
    1 Error(s)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The build is failing at this point:

/Users/builder/azdo/_work/2/s/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellItemRenderer.cs(146,89): error CS0103: The name 'ShellRenderer' does not exist in the current context [/Users/builder/azdo/_work/2/s/src/Controls/src/Core/Controls.Core.csproj::TargetFramework=net9.0-android35.0]
    1 Error(s)

The build issue has been resolved now.

}
_appearanceSet = true;
_appearanceTracker.SetAppearance(_bottomView, appearance);
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue16522.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8" ?>
<Shell xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Maui.Controls.Sample.Issues.Issue16522"
TabBarBackgroundColor="#0000FF"
>
<FlyoutItem Title="Main">
<Tab Title="Main">
<ShellContent>
<ContentPage Title="Main">
<StackLayout Padding="10">
<Label AutomationId="Label" Text="Welcome to the Main Page!"
FontSize="24"
HorizontalOptions="Center" />
<!-- Add additional UI elements here -->
</StackLayout>
</ContentPage>
</ShellContent>
</Tab>

<Tab Title="Settings">
<ShellContent>
<ContentPage Title="Settings">
<StackLayout Padding="10">
<Label Text="Settings Page"
FontSize="24"
HorizontalOptions="Center" />
<!-- Additional UI for Settings -->
</StackLayout>
</ContentPage>
</ShellContent>
</Tab>
</FlyoutItem>

<FlyoutItem Title="About">
<ShellContent>
<ContentPage Title="About">
<StackLayout Padding="10">
<Label Text="About Page"
FontSize="24"
HorizontalOptions="Center" />
<!-- Additional UI for About -->
</StackLayout>
</ContentPage>
</ShellContent>
</FlyoutItem>
</Shell>
12 changes: 12 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue16522.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace Maui.Controls.Sample.Issues
{
[Issue(IssueTracker.Github, 16522, "[Android] Tabs briefly display wrong background color when navigating between flyout items", PlatformAffected.Android)]
public partial class Issue16522 : Shell
{
public Issue16522()
{
InitializeComponent();

}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues
{
public class Issue16522 : _IssuesUITest
{
public Issue16522(TestDevice device) : base(device)
{
}

public override string Issue => "[Android] Tabs briefly display wrong background color when navigating between flyout items";

[Test]
[Category(UITestCategories.Shell)]
public void ShellTabBarBackgroundColor()
{
App.WaitForElement("Label");
App.Tap("Settings");
App.Tap("Main");
App.WaitForElement("Label");
VerifyScreenshot();
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.