Skip to content
Merged
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue30065.cs
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();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pending snapshot on Windows.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Running a build.

Copy link
Copy Markdown
Contributor Author

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.

}
}
#endif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Copilot AI Jun 25, 2025

Copy link

Choose a reason for hiding this comment

The 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.
{

}
Expand Down
2 changes: 1 addition & 1 deletion src/Core/src/Handlers/DatePicker/DatePickerHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Copilot AI Jun 25, 2025

Copy link

Choose a reason for hiding this comment

The 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.
#endif

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Core/src/Handlers/DatePicker/DatePickerHandler.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Copilot AI Jun 25, 2025

Copy link

Choose a reason for hiding this comment

The 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.
{
handler.PlatformView?.UpdateFlowDirection(datePicker);
handler.PlatformView?.UpdateTextAlignment(datePicker);
Expand Down
7 changes: 6 additions & 1 deletion src/Core/src/Platform/iOS/DatePickerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,12 @@ public static void UpdateMaximumDate(this UIDatePicker platformDatePicker, IDate

public static void UpdateTextAlignment(this MauiDatePicker nativeDatePicker, IDatePicker datePicker)
{
// TODO: Update TextAlignment based on the EffectiveFlowDirection property.
var alignment = nativeDatePicker.EffectiveUserInterfaceLayoutDirection ==
UIUserInterfaceLayoutDirection.RightToLeft
? UITextAlignment.Right
: UITextAlignment.Left;

nativeDatePicker.TextAlignment = alignment;
}

internal static void UpdateIsOpen(this MauiDatePicker platformDatePicker, IDatePicker datePicker)
Expand Down
1 change: 0 additions & 1 deletion src/Core/src/PublicAPI/net-ios/PublicAPI.Shipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2642,7 +2642,6 @@ static Microsoft.Maui.Handlers.ContextFlyoutItemHandlerUpdate.operator ==(Micros
static Microsoft.Maui.Handlers.DatePickerHandler.CommandMapper -> Microsoft.Maui.CommandMapper<Microsoft.Maui.IPicker!, Microsoft.Maui.Handlers.IDatePickerHandler!>!
static Microsoft.Maui.Handlers.DatePickerHandler.MapCharacterSpacing(Microsoft.Maui.Handlers.IDatePickerHandler! handler, Microsoft.Maui.IDatePicker! datePicker) -> void
static Microsoft.Maui.Handlers.DatePickerHandler.MapDate(Microsoft.Maui.Handlers.IDatePickerHandler! handler, Microsoft.Maui.IDatePicker! datePicker) -> void
static Microsoft.Maui.Handlers.DatePickerHandler.MapFlowDirection(Microsoft.Maui.Handlers.DatePickerHandler! handler, Microsoft.Maui.IDatePicker! datePicker) -> void
static Microsoft.Maui.Handlers.DatePickerHandler.MapFont(Microsoft.Maui.Handlers.IDatePickerHandler! handler, Microsoft.Maui.IDatePicker! datePicker) -> void
static Microsoft.Maui.Handlers.DatePickerHandler.MapFormat(Microsoft.Maui.Handlers.IDatePickerHandler! handler, Microsoft.Maui.IDatePicker! datePicker) -> void
static Microsoft.Maui.Handlers.DatePickerHandler.MapMaximumDate(Microsoft.Maui.Handlers.IDatePickerHandler! handler, Microsoft.Maui.IDatePicker! datePicker) -> void
Expand Down
2 changes: 2 additions & 0 deletions src/Core/src/PublicAPI/net-ios/PublicAPI.Unshipped.txt
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
Expand Up @@ -2645,7 +2645,6 @@ static Microsoft.Maui.Handlers.ContextFlyoutItemHandlerUpdate.operator ==(Micros
static Microsoft.Maui.Handlers.DatePickerHandler.CommandMapper -> Microsoft.Maui.CommandMapper<Microsoft.Maui.IPicker!, Microsoft.Maui.Handlers.IDatePickerHandler!>!
static Microsoft.Maui.Handlers.DatePickerHandler.MapCharacterSpacing(Microsoft.Maui.Handlers.IDatePickerHandler! handler, Microsoft.Maui.IDatePicker! datePicker) -> void
static Microsoft.Maui.Handlers.DatePickerHandler.MapDate(Microsoft.Maui.Handlers.IDatePickerHandler! handler, Microsoft.Maui.IDatePicker! datePicker) -> void
static Microsoft.Maui.Handlers.DatePickerHandler.MapFlowDirection(Microsoft.Maui.Handlers.DatePickerHandler! handler, Microsoft.Maui.IDatePicker! datePicker) -> void
static Microsoft.Maui.Handlers.DatePickerHandler.MapFont(Microsoft.Maui.Handlers.IDatePickerHandler! handler, Microsoft.Maui.IDatePicker! datePicker) -> void
static Microsoft.Maui.Handlers.DatePickerHandler.MapFormat(Microsoft.Maui.Handlers.IDatePickerHandler! handler, Microsoft.Maui.IDatePicker! datePicker) -> void
static Microsoft.Maui.Handlers.DatePickerHandler.MapMaximumDate(Microsoft.Maui.Handlers.IDatePickerHandler! handler, Microsoft.Maui.IDatePicker! datePicker) -> void
Expand Down
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

Copilot AI Jun 25, 2025

Copy link

Choose a reason for hiding this comment

The 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.
static Microsoft.Maui.Handlers.DatePickerHandler.MapFlowDirection(Microsoft.Maui.Handlers.IDatePickerHandler! handler, Microsoft.Maui.IDatePicker! datePicker) -> void
Loading