-
Notifications
You must be signed in to change notification settings - Fork 2k
[iOS] Fix for DatePicker FlowDirection Not Working on iOS #30193
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 8 commits
cf172f9
163a933
bb2e816
f46d359
5101d96
6dd2d9c
06d600f
c04b33f
710aadd
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,50 @@ | ||
| namespace Controls.TestCases.HostApp.Issues; | ||
|
|
||
| [Issue(IssueTracker.Github, 30065, "DatePicker Ignores FlowDirection When Set to RightToLeft or MatchParent", PlatformAffected.iOS)] | ||
| public class Issue30065 : ContentPage | ||
| { | ||
| public Issue30065() | ||
| { | ||
| DatePicker rtlDatePicker = new DatePicker | ||
| { | ||
| Date = new DateTime(2002, 5, 14), | ||
| Format = "MM/dd/yyyy", | ||
| WidthRequest = 300, | ||
| FlowDirection = FlowDirection.RightToLeft, | ||
| }; | ||
|
|
||
| DatePicker ltrDatePicker = new DatePicker | ||
| { | ||
| Date = new DateTime(2002, 5, 14), | ||
| Format = "MM/dd/yyyy", | ||
| WidthRequest = 300, | ||
| FlowDirection = FlowDirection.LeftToRight, | ||
| }; | ||
|
|
||
| Button toggleButton = new Button | ||
| { | ||
| AutomationId = "ToggleFlowDirectionBtn", | ||
| Text = "Toggle FlowDirection", | ||
| }; | ||
|
|
||
| toggleButton.Clicked += (s, e) => | ||
| { | ||
| rtlDatePicker.FlowDirection = FlowDirection.LeftToRight; | ||
| ltrDatePicker.FlowDirection = FlowDirection.RightToLeft; | ||
| }; | ||
|
|
||
| VerticalStackLayout verticalStackLayout = new VerticalStackLayout | ||
| { | ||
| Padding = new Thickness(20), | ||
| VerticalOptions = LayoutOptions.Center, | ||
| Children = | ||
| { | ||
| rtlDatePicker, | ||
| ltrDatePicker, | ||
| toggleButton | ||
| } | ||
| }; | ||
|
|
||
| Content = verticalStackLayout; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| #if TEST_FAILS_ON_CATALYST // Issue Link - https://github.com/dotnet/maui/issues/30163 | ||
| using NUnit.Framework; | ||
| using UITest.Appium; | ||
| using UITest.Core; | ||
|
|
||
| namespace Microsoft.Maui.TestCases.Tests.Issues; | ||
|
|
||
| public class Issue30065 : _IssuesUITest | ||
| { | ||
| public Issue30065(TestDevice device) : base(device) | ||
| { | ||
| } | ||
|
|
||
| public override string Issue => "DatePicker Ignores FlowDirection When Set to RightToLeft or MatchParent"; | ||
|
|
||
| [Test] | ||
| [Category(UITestCategories.DatePicker)] | ||
| public void ValidateDatePickerFlowDirection() | ||
| { | ||
| App.WaitForElement("ToggleFlowDirectionBtn"); | ||
| App.Tap("ToggleFlowDirectionBtn"); | ||
| VerifyScreenshot(); | ||
| } | ||
| } | ||
| #endif | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -70,7 +70,7 @@ public static partial void MapTextColor(IDatePickerHandler handler, IDatePicker | |
|
|
||
| } | ||
|
|
||
| public static partial void MapFlowDirection(DatePickerHandler handler, IDatePicker datePicker) | ||
| public static partial void MapFlowDirection(IDatePickerHandler handler, IDatePicker datePicker) | ||
|
||
| { | ||
|
|
||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -74,7 +74,7 @@ public DatePickerHandler(IPropertyMapper? mapper, CommandMapper? commandMapper) | |
| /// </summary> | ||
| /// <param name="handler">The associated handler.</param> | ||
| /// <param name="datePicker">The associated <see cref="IDatePicker"/> instance.</param> | ||
| public static partial void MapFlowDirection(DatePickerHandler handler, IDatePicker datePicker); | ||
| public static partial void MapFlowDirection(IDatePickerHandler handler, IDatePicker datePicker); | ||
|
||
| #endif | ||
|
|
||
| /// <summary> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -80,7 +80,7 @@ public static partial void MapTextColor(IDatePickerHandler handler, IDatePicker | |
| handler.PlatformView?.UpdateTextColor(datePicker); | ||
| } | ||
|
|
||
| public static partial void MapFlowDirection(DatePickerHandler handler, IDatePicker datePicker) | ||
| public static partial void MapFlowDirection(IDatePickerHandler handler, IDatePicker datePicker) | ||
|
||
| { | ||
| handler.PlatformView?.UpdateFlowDirection(datePicker); | ||
| handler.PlatformView?.UpdateTextAlignment(datePicker); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,4 @@ | ||
| #nullable enable | ||
| override Microsoft.Maui.Platform.MauiView.DidUpdateFocus(UIKit.UIFocusUpdateContext! context, UIKit.UIFocusAnimationCoordinator! coordinator) -> void | ||
| *REMOVED*static Microsoft.Maui.Handlers.DatePickerHandler.MapFlowDirection(Microsoft.Maui.Handlers.DatePickerHandler! handler, Microsoft.Maui.IDatePicker! datePicker) -> void | ||
| static Microsoft.Maui.Handlers.DatePickerHandler.MapFlowDirection(Microsoft.Maui.Handlers.IDatePickerHandler! handler, Microsoft.Maui.IDatePicker! datePicker) -> void |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,4 @@ | ||
| #nullable enable | ||
| override Microsoft.Maui.Platform.MauiView.DidUpdateFocus(UIKit.UIFocusUpdateContext! context, UIKit.UIFocusAnimationCoordinator! coordinator) -> void | ||
| *REMOVED*static Microsoft.Maui.Handlers.DatePickerHandler.MapFlowDirection(Microsoft.Maui.Handlers.DatePickerHandler! handler, Microsoft.Maui.IDatePicker! datePicker) -> void | ||
|
||
| static Microsoft.Maui.Handlers.DatePickerHandler.MapFlowDirection(Microsoft.Maui.Handlers.IDatePickerHandler! handler, Microsoft.Maui.IDatePicker! datePicker) -> void | ||
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.
Pending snapshot on Windows.
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.
Running a build.
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.
@jsuarezruiz , I've updated the test case and added snapshots for iOS and Android. I will add the missing snap in the next CI run.