Skip to content

[iOS 26] Fix Switch ThumbColor and OffColor not applied on initial load#35400

Merged
kubaflo merged 5 commits into
dotnet:inflight/currentfrom
SyedAbdulAzeemSF4852:fix-ios26-35257
May 20, 2026
Merged

[iOS 26] Fix Switch ThumbColor and OffColor not applied on initial load#35400
kubaflo merged 5 commits into
dotnet:inflight/currentfrom
SyedAbdulAzeemSF4852:fix-ios26-35257

Conversation

@SyedAbdulAzeemSF4852

@SyedAbdulAzeemSF4852 SyedAbdulAzeemSF4852 commented May 12, 2026

Copy link
Copy Markdown
Contributor

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Issue Details

  • On iOS 26+, Switch colors are broken on initial load — OffColor is not applied at startup, and ThumbColor is never applied at all
  • After toggling and returning to initial state, OffColor appears but ThumbColor still doesn't apply.

Root Cause

  • On iOS 26, Apple's "Liquid Glass" redesign introduces an internal UIKit styling pass that executes after MAUI's ConnectHandler completes, resetting UISwitch properties such as ThumbTintColor and the off-state track color back to system defaults.

Description of Change

  • PR [iOS] Fix Switch ThumbColor reset on iOS 26+ theme changes. #33953 fixes ThumbColor not being applied correctly on iOS/MacCatalyst 26+ by deferring re-application via DispatchAsync after UIKit's styling pass.
  • This change enhances that fix to also re-apply TrackColor in the same deferred dispatch, since iOS 26's internal styling pass resets both ThumbTintColor and the off-state track color. The TrackColor re-application applies to both iOS and Mac Catalyst 26+, as both platforms exhibit this reset behavior. The method is also renamed from UpdateThumbColor to UpdateThumbAndTrackColor to accurately reflect that it now handles both colors.

Issues Fixed

Fixes #35257

Validated the behaviour in the following platforms

  • Windows
  • Android
  • iOS
  • Mac

Output

Before After
Before.mov
After.mov

@dotnet-policy-service dotnet-policy-service Bot added the community ✨ Community Contribution label May 12, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

@kubaflo

kubaflo commented May 12, 2026

Copy link
Copy Markdown
Contributor

@SyedAbdulAzeemSF4852 would it make this one: #35385 not needed?

@SyedAbdulAzeemSF4852

Copy link
Copy Markdown
Contributor Author

@SyedAbdulAzeemSF4852 would it make this one: #35385 not needed?

@kubaflo , This PR is an enhancement to PR #33953 (already merged into inflight/current), which fixes ThumbColor reset on iOS/Mac Catalyst 26+ theme changes. This PR extends that same fix to also re-apply TrackColor in the deferred dispatch. PR #35385 takes a completely different approach.

@sheiksyedm sheiksyedm marked this pull request as ready for review May 13, 2026 10:02
@MauiBot MauiBot added s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review) labels May 13, 2026
@kubaflo

kubaflo commented May 19, 2026

Copy link
Copy Markdown
Contributor

/review -b feature/regression-check -p ios

1 similar comment
@kubaflo

kubaflo commented May 19, 2026

Copy link
Copy Markdown
Contributor

/review -b feature/regression-check -p ios

@MauiBot MauiBot added s/agent-review-incomplete and removed s/agent-changes-requested AI agent recommends changes - found a better alternative or issues labels May 19, 2026
@kubaflo

kubaflo commented May 19, 2026

Copy link
Copy Markdown
Contributor

/review -b feature/regression-check -p ios

KarthikRajaKalaimani and others added 5 commits May 20, 2026 12:49
…net#34527)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Issue Details:

Horizontalspacing / Verticalspacing is not not applied to the first
column in GridItemLayout using CollectionView on Android platform.
        
### Root Cause:

The grid spacing was not being distributed symmetrically across the
active layout implementations, so edge items did not fully participate
when spacing changed at runtime.

### Description of Change:

- On Android, the fix in MauiRecyclerView.cs changes how RecyclerView
padding is handled for GridItemsLayout. Android was already using
SpacingItemDecoration, which applies half-spacing on all four sides of
each item. Previously, negative RecyclerView padding canceled that
spacing at the control edges. The branch keeps that negative-padding
behavior for non-grid layouts, but disables it for GridItemsLayout,
allowing the grid’s half-spacing to remain visible at the outer
perimeter. This makes the first row and first column visually respond
when spacing changes, but it also changes the grid behavior from spacing
only between items to spacing around the outside edges as well.

**Tested the behavior in the following platforms:**

- [x] Android
- [x] Windows
- [ ] iOS
- [ ] Mac

### Reference:

N/A

### Issues Fixed:

Fixes  dotnet#34257      

### Screenshots
| Before  | After  |
|---------|--------|
| <Video
src="https://github.com/user-attachments/assets/578dda69-1d60-474c-a6d8-23b3f9d29a50"
Width="300" Height="600"> | <Video
src="https://github.com/user-attachments/assets/7f3826e6-5922-4b6f-a6b9-de581b7db6c3"
Width="300" Height="600"> |
@kubaflo

kubaflo commented May 20, 2026

Copy link
Copy Markdown
Contributor

/review -b feature/regression-check -p ios

@kubaflo kubaflo merged commit 2a68757 into dotnet:inflight/current May 20, 2026
33 of 36 checks passed
@github-actions github-actions Bot added this to the .NET 10.0 SR8 milestone May 20, 2026
@kubaflo kubaflo added s/agent-gate-failed AI could not verify tests catch the bug s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates s/agent-changes-requested AI agent recommends changes - found a better alternative or issues and removed s/agent-review-incomplete labels May 20, 2026
@dotnet dotnet deleted a comment from MauiBot May 20, 2026
@kubaflo

kubaflo commented May 20, 2026

Copy link
Copy Markdown
Contributor

/review -b feature/regression-check -p ios

PureWeen pushed a commit that referenced this pull request Jun 2, 2026
…oad (#35400)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Issue Details
- On iOS 26+, Switch colors are broken on initial load — OffColor is not
applied at startup, and ThumbColor is never applied at all
- After toggling and returning to initial state, OffColor appears but
ThumbColor still doesn't apply.

### Root Cause
- On iOS 26, Apple's "Liquid Glass" redesign introduces an internal
UIKit styling pass that executes after MAUI's ConnectHandler completes,
resetting UISwitch properties such as ThumbTintColor and the off-state
track color back to system defaults.

### Description of Change
- PR #33953 fixes ThumbColor not being applied correctly on
iOS/MacCatalyst 26+ by deferring re-application via DispatchAsync after
UIKit's styling pass.
- This change enhances that fix to also re-apply TrackColor in the same
deferred dispatch, since iOS 26's internal styling pass resets both
ThumbTintColor and the off-state track color. The TrackColor
re-application applies to both iOS and Mac Catalyst 26+, as both
platforms exhibit this reset behavior. The method is also renamed from
UpdateThumbColor to UpdateThumbAndTrackColor to accurately reflect that
it now handles both colors.


### Issues Fixed
Fixes #35257

### Validated the behaviour in the following platforms

- [ ] Windows
- [ ] Android
- [x] iOS
- [x] Mac

### Output
| Before | After |
|----------|----------|
| <video
src="https://github.com/user-attachments/assets/2ea7a96f-2adc-4381-af0e-3e57f161083a">
| <video
src="https://github.com/user-attachments/assets/9ea09f9d-ebbf-48c6-92bc-3f393b42ba41">
|

---------

Co-authored-by: KarthikRajaKalaimani <92777139+KarthikRajaKalaimani@users.noreply.github.com>
PureWeen pushed a commit that referenced this pull request Jun 11, 2026
…oad (#35400)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Issue Details
- On iOS 26+, Switch colors are broken on initial load — OffColor is not
applied at startup, and ThumbColor is never applied at all
- After toggling and returning to initial state, OffColor appears but
ThumbColor still doesn't apply.

### Root Cause
- On iOS 26, Apple's "Liquid Glass" redesign introduces an internal
UIKit styling pass that executes after MAUI's ConnectHandler completes,
resetting UISwitch properties such as ThumbTintColor and the off-state
track color back to system defaults.

### Description of Change
- PR #33953 fixes ThumbColor not being applied correctly on
iOS/MacCatalyst 26+ by deferring re-application via DispatchAsync after
UIKit's styling pass.
- This change enhances that fix to also re-apply TrackColor in the same
deferred dispatch, since iOS 26's internal styling pass resets both
ThumbTintColor and the off-state track color. The TrackColor
re-application applies to both iOS and Mac Catalyst 26+, as both
platforms exhibit this reset behavior. The method is also renamed from
UpdateThumbColor to UpdateThumbAndTrackColor to accurately reflect that
it now handles both colors.


### Issues Fixed
Fixes #35257

### Validated the behaviour in the following platforms

- [ ] Windows
- [ ] Android
- [x] iOS
- [x] Mac

### Output
| Before | After |
|----------|----------|
| <video
src="https://github.com/user-attachments/assets/2ea7a96f-2adc-4381-af0e-3e57f161083a">
| <video
src="https://github.com/user-attachments/assets/9ea09f9d-ebbf-48c6-92bc-3f393b42ba41">
|

---------

Co-authored-by: KarthikRajaKalaimani <92777139+KarthikRajaKalaimani@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-controls-switch Switch community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/ios s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates s/agent-gate-failed AI could not verify tests catch the bug s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review) version/iOS-26

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants