CommunityToolkit / CommunityToolkit/Maui

[BUG] Setting Android using NavigationBar.Color in xaml or code permanently changes the navigationBar color everywhere rather than just that ContentPage

Open
#1,987 2 comments 0 reactions 0 assignees View on GitHub
area/behaviors bug unverified
Dominant language
C#
Stars
2.7k
Forks
500
Avg merge
2d 14h
Merged PRs (30d)
7

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Did you read the "Reporting a bug" section on Contributing file?

- [X] I have read the "Reporting a bug" section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug

### Current Behavior

Setting the NavigationBar.Color in xaml or code sets it app wide. This is easy to do using Android styles.xml and colors.xml anyway.

### Expected Behavior

I would expect the color to only be changed for the specifc ContentPage I was on, so that in my own applications I can set specific colours for specific screens for a specific look and feel.

### Steps To Reproduce

Run the sample app on Android and navigate to Platform Specific -> NavigationBar.

Use the slider to set the NavigationBar color like so:

Screenshot 2024-06-26 at 16 14 20

And then navigate away from this screen:

Screenshot 2024-06-26 at 16 14 32

### Link to public reproduction project repository

https://github.com/CommunityToolkit/Maui/tree/main/samples/CommunityToolkit.Maui.Sample/Pages/PlatformSpecific

### Environment

```markdown
- .NET MAUI CommunityToolkit:9.0.1
- OS: Android
- .NET MAUI: 8.0.300 (I think)
```

### Anything else?

Thanks!

Contributor guide

Open the contributing guide

Research direction

Start by running the sample app from samples/CommunityToolkit.Maui.Sample/Pages/PlatformSpecific on Android and reproduce the NavigationBar color change with the slider. Trace how NavigationBar.Color is applied when navigating between ContentPage instances. Done means a color set on one page does not remain app-wide and the behavior is covered by an appropriate regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, csharp
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.