From 162dee578f19ef3e2f159c94ce240dce45b9c8d3 Mon Sep 17 00:00:00 2001 From: David Oliver Date: Thu, 28 Oct 2021 10:47:56 -0400 Subject: [PATCH] fix(transformtovisual): [iOS] Fix TransformToVisual inside ListView Fix regression introduced by https://github.com/unoplatform/uno/pull/5944 . TransformToVisual() is now calculated correctly for elements within the hierarchy of a ListView, accounting for the presence of intermediate native elements. (cherry picked from commit b3c0a7bdabb4d11d967906c9bad28f3e68ce8719) --- .../Given_UIElement.TransformToVisual.cs | 55 ++++++++++++++++++- .../ListViewBase/ListViewBaseSource.iOS.cs | 3 +- src/Uno.UI/UI/Xaml/FrameworkElement.iOS.cs | 6 +- src/Uno.UI/UI/Xaml/UIElement.iOS.cs | 6 ++ 4 files changed, 67 insertions(+), 3 deletions(-) diff --git a/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml/Given_UIElement.TransformToVisual.cs b/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml/Given_UIElement.TransformToVisual.cs index 933cb9feb597..2d09a1bae9ab 100644 --- a/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml/Given_UIElement.TransformToVisual.cs +++ b/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml/Given_UIElement.TransformToVisual.cs @@ -16,13 +16,15 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Private.Infrastructure; using Uno.Extensions; -using Uno.UI.Extensions; using DependencyObjectExtensions = Uno.UI.Extensions.DependencyObjectExtensions; using static Private.Infrastructure.TestServices.WindowHelper; using Windows.UI.Xaml.Shapes; +using Uno.UI.RuntimeTests.Helpers; #if __IOS__ using UIKit; +#else +using Uno.UI.Extensions; #endif namespace Uno.UI.RuntimeTests.Tests.Windows_UI_Xaml @@ -146,6 +148,57 @@ void AssertItem(int index) } } #endif + [TestMethod] + [RunsOnUIThread] + public async Task When_TransformToVisual_Through_ListView_Scrolled() + { + var listView = new ListView + { + ItemContainerStyle = TestsResourceHelper.GetResource