Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
65 changes: 65 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue6101.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
namespace Maui.Controls.Sample.Issues;

[Issue(IssueTracker.Github, 6101, "Picker items do not appear when tapping on the picker while using PushModalAsync for navigation", PlatformAffected.macOS)]

public class Issue6101Shell : Shell
{
public Issue6101Shell()
{
FlyoutBehavior = FlyoutBehavior.Disabled;

ShellContent shellContent = new ShellContent
{
ContentTemplate = new DataTemplate(typeof(Issue6101)),
Route = "MainPage"
};

Items.Add(shellContent);
}

public class Issue6101 : ContentPage
{
public Issue6101()
{
Content = new StackLayout
{
Children =
{
new Button
{
Text = "Navigate to page that opens modal",
AutomationId = "Button",
Command = new Command(() => Navigation.PushModalAsync(new Issue6101Page1()))
}
}
};
}
}

public class Issue6101Page1 : ContentPage
{
public Issue6101Page1()
{
Content = new VerticalStackLayout()
{
Children =
{
new Picker
{
AutomationId = "Picker",
ItemsSource = new List<string> { "Item 1", "Item 2", "Item 3" } ,
SelectedIndex = 0,
}
}
};
}
}
}








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
@@ -0,0 +1,26 @@
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues
{
public class Issue6101 : _IssuesUITest
{
public override string Issue => "Picker items do not appear when tapping on the picker while using PushModalAsync for navigation";

public Issue6101(TestDevice device) : base(device)
{
}

[Test]
[Category(UITestCategories.Picker)]
public void ShouldAppearItemsWhenTappingOnPickerUsingPushModalAsync()
{
App.WaitForElement("Button");
App.Tap("Button");
App.WaitForElement("Picker");
App.Click("Picker");
VerifyScreenshot();
Copy link
Contributor

Choose a reason for hiding this comment

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

Pending snapshots (Mac and Windows). Already available in the latest build.

Example:
image

Could you commit the images?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Pending snapshots (Mac and Windows). Already available in the latest build.

Example: image

Could you commit the images?

Hi @jsuarezruiz ,

  • Pending snapshots have been committed.

}
}
}
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.
20 changes: 18 additions & 2 deletions src/Core/src/Handlers/Picker/PickerHandler.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,27 @@ void DisplayAlert(MauiPicker uITextField)
uITextField.EditingDidEnd += editingDidEndHandler;

var platformWindow = MauiContext?.GetPlatformWindow();
platformWindow?.BeginInvokeOnMainThread(() =>
if (platformWindow is null)
{
_ = platformWindow?.RootViewController?.PresentViewControllerAsync(pickerController, true);
return;
}

var currentViewController = GetCurrentViewController(platformWindow.RootViewController);
platformWindow.BeginInvokeOnMainThread(() =>
{
currentViewController?.PresentViewControllerAsync(pickerController, true);
});
}

static UIViewController? GetCurrentViewController(UIViewController? viewController)
{
while (viewController?.PresentedViewController != null)
{
viewController = viewController.PresentedViewController;
}

return viewController;
}
#endif

internal bool UpdateImmediately { get; set; }
Expand Down
Loading