Skip to content

Comments

[Android] Fixed the Incorrect Text Color Applied to Selected Tab in TabbedPage#28844

Merged
PureWeen merged 2 commits intodotnet:inflight/currentfrom
Ahamed-Ali:fix-28838
Apr 11, 2025
Merged

[Android] Fixed the Incorrect Text Color Applied to Selected Tab in TabbedPage#28844
PureWeen merged 2 commits intodotnet:inflight/currentfrom
Ahamed-Ali:fix-28838

Conversation

@Ahamed-Ali
Copy link
Contributor

Issue

  • When setting only the UnselectedTabColor on a TabbedPage, the selected tab's text color incorrectly adopts the unselected tab color on Android.

Root Cause of the issue

  • The text colors for selected and unselected tabs were not handled correctly.

Description of Change

  • Implemented proper handling of text colors for both selected and unselected tabs to ensure correct behavior in both default and explicitly defined color scenarios.

Issues Fixed

Fixes #28838

Tested the behaviour in the following platforms

  • Android
  • Windows
  • iOS
  • Mac

Screenshot

Before Issue Fix After Issue Fix

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Apr 8, 2025
@dotnet-policy-service
Copy link
Contributor

Hey there @@Ahamed-Ali! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@dotnet-policy-service dotnet-policy-service bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Apr 8, 2025
else
{
// UnSelected tabs TextColor
if (barItemColor is not null)
Copy link
Contributor

Choose a reason for hiding this comment

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

Here we repeat some code and can just create a new method:

int GetItemTextColor(Color? customColor, OriginalTabTextColors? originalColors)
{
    return customColor?.ToPlatform().ToArgb() ?? originalColors?.DefaultColor ?? 0;
}

To get a cleaner version:

// UnSelected tabs TextColor
  defaultColor = GetItemTextColor(barItemColor, _originalTabTextColors);

  // Selected tabs TextColor
  checkedColor = GetItemTextColor(barSelectedItemColor, _originalTabTextColors);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the feedback. I have optimized the code as suggested @jsuarezruiz

public void DefaultSelectedTabTextColorShouldApplyProperly()
{
App.WaitForElement("Tab1");
VerifyScreenshot();
Copy link
Contributor

Choose a reason for hiding this comment

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

Pending snapshots in Android, Mac and Windows. Trigger a build.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have added the pending snapshots.

@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@Ahamed-Ali Ahamed-Ali marked this pull request as ready for review April 10, 2025 11:31
@Ahamed-Ali Ahamed-Ali requested a review from a team as a code owner April 10, 2025 11:31
@PureWeen PureWeen changed the base branch from main to inflight/current April 11, 2025 15:41
@PureWeen PureWeen merged commit 6cc3345 into dotnet:inflight/current Apr 11, 2025
3 checks passed
PureWeen pushed a commit that referenced this pull request Apr 16, 2025
…abbedPage (#28844)

* Fixed the Incorrect Text Color Applied to Selected Tab in TabbedPage on Android

* Added pending snap and optimized the fix
sheiksyedm pushed a commit to sheiksyedm/maui that referenced this pull request Apr 17, 2025
…abbedPage (dotnet#28844)

* Fixed the Incorrect Text Color Applied to Selected Tab in TabbedPage on Android

* Added pending snap and optimized the fix
NanthiniMahalingam pushed a commit to NanthiniMahalingam/maui that referenced this pull request Apr 17, 2025
…abbedPage (dotnet#28844)

* Fixed the Incorrect Text Color Applied to Selected Tab in TabbedPage on Android

* Added pending snap and optimized the fix
github-actions bot pushed a commit that referenced this pull request Apr 18, 2025
…abbedPage (#28844)

* Fixed the Incorrect Text Color Applied to Selected Tab in TabbedPage on Android

* Added pending snap and optimized the fix
PureWeen added a commit that referenced this pull request Apr 23, 2025
### Description of Change

## .NET MAUI Release Notes - Inflight/Candidate

## What's Changed

### MAUI Product Fixes
* Fix CarouselView layout SR6 regressions by @albyrock87 in
#29035
* Revert "[Android] picker - focus/unfocus events (#28122)" by @PureWeen
in https://github.com/dotnet/maui/pull/1fb5164929
* [Windows] Fixed the flyout content width not being set correctly after
updating to WinUI SDK 1.7 by @Tamilarasan-Paranthaman in
#28996
* [Android] picker - focus/unfocus events by @kubaflo in
#28122
* [XC] add IRootObjectProvider by @StephaneDelcroix in
#28310
* [iOS] Fix for the File.ContentType from MediaPicker not being in valid
MIME format by @SyedAbdulAzeemSF4852 in
#28842
* [Android] Fixed the Incorrect Text Color Applied to Selected Tab in
TabbedPage by @Ahamed-Ali in #28844
* [iOS] Fix FlyoutPage does not respond to changes in the
FlyoutLayoutBehavior property by @devanathan-vaithiyanathan in
#28884
* [Android] Fixed ScalingCanvas.SetBlur not working by
@NirmalKumarYuvaraj in #28911
* [iOS] - Resolved Proper Rendering of Dynamic Header/Footer Updates in
CV2 by @prakashKannanSf3972 in #28641
* [iOS] Fixed the TargetInvocationException Occurs When Selecting
Header/Footer After Changing ItemsLayout in CV2 by @Ahamed-Ali in
#28890
* [Windows] - Fix Visual State Issue with Picker TextColor After
Navigation by @prakashKannanSf3972 in
#28746

### Dependency Updates
* [Windows] Upgrade to Windows App SDK 1.7 by @MartyIX in
#28499

### Testing
* [Testing] Feature Matrix UITest Cases for CollectionView EmptyView
Feature by @NafeelaNazhir in #28679
* Fixed Test case failure in PR 29037 - [2025/04/21] Candidate by
@HarishKumarSF4517 in #29049

**Full Changelog**:
main...inflight/candidate


For more information about inflight process check
https://github.com/dotnet/maui/wiki/Inflight-Branch-Process
@github-actions github-actions bot locked and limited conversation to collaborators May 12, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-controls-tabbedpage TabbedPage community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/android

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect Text Color Applied to Selected Tab in TabbedPage on Android

3 participants