-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[iOS] SwipeView: Honor FontImageSource.Color in SwipeItem icon #27389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2f22928
2c6474f
3e2acb4
538463e
e8265c0
6c123d7
3db25c2
2cc38a2
5594c7b
695cb62
bf17960
385a3c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| --- | ||
| applyTo: | ||
| - "**/Platform/iOS/MauiView.cs" | ||
| - "**/Platform/iOS/MauiScrollView.cs" | ||
| - "**/Platform/iOS/*SafeArea*" | ||
| --- | ||
|
|
||
| # Safe Area Guidelines (iOS/macCatalyst) | ||
|
|
||
| ## Platform Differences | ||
|
|
||
| | | macOS 14/15 | macOS 26+ | | ||
| |-|-------------|-----------| | ||
| | Title bar inset | ~28px | ~0px | | ||
| | Used in CI | ✅ | ❌ | | ||
|
|
||
| Local macOS 26+ testing does NOT validate CI behavior. Fixes must pass CI on macOS 14/15. | ||
|
|
||
| | Platform | `UseSafeArea` default | | ||
| |----------|-----------------------| | ||
| | iOS | `false` | | ||
| | macCatalyst | `true` | | ||
|
|
||
| ## Architecture (PR #34024) | ||
|
|
||
| **`IsParentHandlingSafeArea`** — before applying adjustments, `MauiView`/`MauiScrollView` walk ancestors to check if any ancestor handles the **same edges**. If so, descendant skips (avoids double-padding). Edge-aware: parent handling `Top` does not block child handling `Bottom`. Result cached in `bool? _parentHandlesSafeArea`; cleared on `SafeAreaInsetsDidChange`, `InvalidateSafeArea`, `MovedToWindow`. `AppliesSafeAreaAdjustments` is `internal` for cross-type ancestor checks. | ||
|
|
||
| **`EqualsAtPixelLevel`** — safe area compared at device-pixel resolution to absorb sub-pixel animation noise (`0.0000001pt` during `TranslateToAsync`), preventing oscillation loops (#32586, #33934). | ||
|
|
||
| ## Anti-Patterns | ||
|
|
||
| **❌ Window Guard** — comparing `Window.SafeAreaInsets` to filter callbacks blocks legitimate updates. On macCatalyst + custom TitleBar, `WindowViewController` pushes content down, changing the **view's** `SafeAreaInsets` without changing the **window's**. Caused 28px CI shift (macOS 14/15 only). Never gate per-view callbacks on window-level insets. | ||
|
|
||
| **❌ Semantic mismatch** — `_safeArea` is filtered by `GetSafeAreaForEdge` (zeroes edges per `SafeAreaRegions`); raw `UIView.SafeAreaInsets` includes all edges. Never compare them — compare raw-to-raw or adjusted-to-adjusted. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ trigger: | |
| - release/* | ||
| - net*.0 | ||
| - inflight/* | ||
| - darc-* | ||
| tags: | ||
| include: | ||
| - '*' | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ trigger: | |
| - release/* | ||
| - net*.0 | ||
| - inflight/* | ||
| - darc-* | ||
| tags: | ||
| include: | ||
| - '*' | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| <?xml version="1.0" encoding="utf-8" ?> | ||
| <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
| x:Class="Maui.Controls.Sample.Issues.Issue27377" | ||
| xmlns:ns="clr-namespace:Maui.Controls.Sample.Issues"> | ||
| <VerticalStackLayout> | ||
| <Border | ||
| VerticalOptions="Start" | ||
| StrokeThickness="1"> | ||
| <SwipeView x:Name="swipeView"> | ||
| <SwipeView.RightItems> | ||
| <SwipeItem | ||
| Text="Action" | ||
| x:Name="swipeItem" | ||
| BackgroundColor="Orange"> | ||
| <SwipeItem.IconImageSource> | ||
| <FontImageSource | ||
| FontFamily="Ionicons" | ||
| Color="Red" | ||
| Size="22" | ||
| Glyph="T"/> | ||
|
Comment on lines
+17
to
+21
|
||
| </SwipeItem.IconImageSource> | ||
| </SwipeItem> | ||
| </SwipeView.RightItems> | ||
| <Label | ||
| Text="SwipeView" | ||
| HeightRequest="100" | ||
| VerticalTextAlignment="Center"/> | ||
| </SwipeView> | ||
| </Border> | ||
| <Button Text="Open" | ||
| AutomationId="Button" | ||
| Clicked="Button_Clicked"/> | ||
| </VerticalStackLayout> | ||
| </ContentPage> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| namespace Maui.Controls.Sample.Issues; | ||
|
|
||
| [Issue(IssueTracker.Github, 27377, "SwipeView: SwipeItem.IconImageSource.FontImageSource color value not honored", PlatformAffected.iOS)] | ||
| public partial class Issue27377 : ContentPage | ||
| { | ||
| public Issue27377() | ||
| { | ||
| InitializeComponent(); | ||
| } | ||
|
|
||
| private void Button_Clicked(object sender, EventArgs e) | ||
| { | ||
| swipeView.Open(OpenSwipeItem.RightItems, true); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| <?xml version="1.0" encoding="utf-8" ?> | ||
| <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
| x:Class="Maui.Controls.Sample.Issues.Issue28986_ParentChildTest" | ||
| Title="Issue28986 - Parent Child SafeArea"> | ||
|
|
||
| <Grid x:Name="ParentGrid" | ||
| BackgroundColor="#FFEB3B" | ||
| SafeAreaEdges="None,Container,None,None" | ||
| AutomationId="ParentGrid"> | ||
|
|
||
| <Grid.RowDefinitions> | ||
| <RowDefinition Height="Auto"/> | ||
| <RowDefinition Height="*"/> | ||
| <RowDefinition Height="Auto"/> | ||
| </Grid.RowDefinitions> | ||
|
|
||
| <!-- Top Indicator --> | ||
| <Label Grid.Row="0" | ||
| Text="↑ Parent handles TOP safe area ↑" | ||
| BackgroundColor="#FF5722" | ||
| TextColor="White" | ||
| HorizontalTextAlignment="Center" | ||
| AutomationId="TopIndicator"/> | ||
|
|
||
| <!-- Middle Content Area --> | ||
| <VerticalStackLayout Grid.Row="1" | ||
| BackgroundColor="#00BCD4" | ||
| VerticalOptions="Center" | ||
| Spacing="20" | ||
| Padding="20"> | ||
|
|
||
| <Label Text="SafeAreaEdges Independent Handling Demo" | ||
| FontSize="20" | ||
| FontAttributes="Bold" | ||
| HorizontalTextAlignment="Center" | ||
| AutomationId="TitleLabel"/> | ||
|
|
||
| <Label x:Name="StatusLabel" | ||
| Text="Parent: Top=Container, Bottom=None | Child: Bottom=Container" | ||
| HorizontalTextAlignment="Center" | ||
| AutomationId="StatusLabel"/> | ||
|
|
||
| <Button Text="Toggle Parent Top SafeArea" | ||
| Clicked="OnToggleParentTop" | ||
| HorizontalOptions="Center" | ||
| AutomationId="ToggleParentTopButton"/> | ||
|
|
||
| <Button Text="Toggle Parent Bottom SafeArea" | ||
| Clicked="OnToggleParentBottom" | ||
| HorizontalOptions="Center" | ||
| AutomationId="ToggleParentBottomButton"/> | ||
|
|
||
| <Button Text="Toggle Child Bottom SafeArea" | ||
| Clicked="OnToggleChildBottom" | ||
| HorizontalOptions="Center" | ||
| AutomationId="ToggleChildBottomButton"/> | ||
|
|
||
| <Label Text="Expected behavior:" | ||
| FontAttributes="Bold" | ||
| Margin="0,20,0,0" | ||
| AutomationId="ExpectedLabel"/> | ||
|
|
||
| <Label Text="• Top indicator stays below notch/status bar (parent handles top)
• Bottom indicator stays above home indicator (child handles bottom)
• Both work INDEPENDENTLY - no conflict!
• Runtime changes to parent do NOT disrupt child's handling
• NO DOUBLE PADDING when both parent and child handle same edge" | ||
| FontSize="12" | ||
| AutomationId="ExpectedDetailsLabel"/> | ||
|
|
||
| </VerticalStackLayout> | ||
|
|
||
| <!-- Bottom Indicator --> | ||
| <Grid Grid.Row="2" | ||
| BackgroundColor="#9C27B0" | ||
| x:Name="ChildGrid" | ||
| SafeAreaEdges="None,None,None,Container" | ||
| AutomationId="ChildGrid"> | ||
|
|
||
| <Label Text="↓ Child handles BOTTOM safe area ↓" | ||
| BackgroundColor="#8BC34A" | ||
| HorizontalTextAlignment="Center" | ||
| AutomationId="BottomIndicator"/> | ||
|
|
||
| </Grid> | ||
| </Grid> | ||
| </ContentPage> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The xmlns:ns namespace declaration isn’t used in this XAML file. Please remove it to avoid unnecessary noise and potential XAML compiler warnings.