-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[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
base: main
Are you sure you want to change the base?
Changes from all commits
cd12d6f
afc6347
3285a3f
20a54a3
d2ada28
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,48 @@ | ||
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), | ||
WidthRequest = 300, | ||
FlowDirection = FlowDirection.RightToLeft, | ||
}; | ||
|
||
DatePicker ltrDatePicker = new DatePicker | ||
{ | ||
Date = new DateTime(2002, 5, 14), | ||
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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The MapFlowDirection signature update on MacCatalyst is a breaking API change. Ensure that documentation and clients targeting MacCatalyst are updated accordingly. Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||
{ | ||
|
||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,7 +73,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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The updated MapFlowDirection signature in the handler class changes the public API contract. This is a breaking change; please ensure API consumers are notified. Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||
#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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The method signature change for MapFlowDirection in the iOS handler is a breaking API change. Ensure that all related documentation and client codes reflect the new interface usage. Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||
{ | ||
handler.PlatformView?.UpdateFlowDirection(datePicker); | ||
handler.PlatformView?.UpdateTextAlignment(datePicker); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,3 +157,5 @@ virtual Microsoft.Maui.SwipeViewSwipeStarted.<Clone>$() -> Microsoft.Maui.SwipeV | |
virtual Microsoft.Maui.SwipeViewSwipeStarted.EqualityContract.get -> System.Type! | ||
virtual Microsoft.Maui.SwipeViewSwipeStarted.Equals(Microsoft.Maui.SwipeViewSwipeStarted? other) -> bool | ||
virtual Microsoft.Maui.SwipeViewSwipeStarted.PrintMembers(System.Text.StringBuilder! builder) -> bool | ||
*REMOVED*static Microsoft.Maui.Handlers.DatePickerHandler.MapFlowDirection(Microsoft.Maui.Handlers.DatePickerHandler! handler, Microsoft.Maui.IDatePicker! datePicker) -> void | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The removal and update of the MapFlowDirection signature here introduces a breaking change in the public API. Please ensure that all consumers are aware of this change and update their implementations accordingly. Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||
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.