diff --git a/src/Controls/src/Core/Compatibility/Handlers/Android/FrameRenderer.cs b/src/Controls/src/Core/Compatibility/Handlers/Android/FrameRenderer.cs
index 8e44dd50f9c6..7d46c50d99a5 100644
--- a/src/Controls/src/Core/Compatibility/Handlers/Android/FrameRenderer.cs
+++ b/src/Controls/src/Core/Compatibility/Handlers/Android/FrameRenderer.cs
@@ -28,7 +28,27 @@ public static IPropertyMapper Mapper
[Frame.CornerRadiusProperty.PropertyName] = (h, _) => h.UpdateCornerRadius(),
[Frame.BorderColorProperty.PropertyName] = (h, _) => h.UpdateBorderColor(),
[Microsoft.Maui.Controls.Compatibility.Layout.IsClippedToBoundsProperty.PropertyName] = (h, _) => h.UpdateClippedToBounds(),
- [Frame.ContentProperty.PropertyName] = (h, _) => h.UpdateContent()
+ [Frame.ContentProperty.PropertyName] = (h, _) => h.UpdateContent(),
+
+ // TODO NET8. These are all needed because the AndroidBatchMapper doesn't run via the mapper it's a manual call on ViewHandler
+ // With NET8 we can move the BatchMapper call to the actual ViewHandler.Mapper.
+ // Because we most likely want to backport these fixes to NET7, I've just opted to add these manually for now on Frame
+ [nameof(IView.AutomationId)] = (h, v) => ViewHandler.MapAutomationId(h, v),
+ [nameof(IView.IsEnabled)] = (h, v) => ViewRenderer.VisualElementRendererMapper.UpdateProperty(h, v, nameof(IView.IsEnabled)),
+ [nameof(IView.Visibility)] = (h, v) => ViewRenderer.VisualElementRendererMapper.UpdateProperty(h, v, nameof(IView.Visibility)),
+ [nameof(IView.MinimumHeight)] = (h, v) => ViewRenderer.VisualElementRendererMapper.UpdateProperty(h, v, nameof(IView.MinimumHeight)),
+ [nameof(IView.MinimumWidth)] = (h, v) => ViewRenderer.VisualElementRendererMapper.UpdateProperty(h, v, nameof(IView.MinimumWidth)),
+ [nameof(IView.Opacity)] = (h, v) => ViewRenderer.VisualElementRendererMapper.UpdateProperty(h, v, nameof(IView.Opacity)),
+ [nameof(IView.TranslationX)] = (h, v) => ViewRenderer.VisualElementRendererMapper.UpdateProperty(h, v, nameof(IView.TranslationX)),
+ [nameof(IView.TranslationY)] = (h, v) => ViewRenderer.VisualElementRendererMapper.UpdateProperty(h, v, nameof(IView.TranslationY)),
+ [nameof(IView.Scale)] = (h, v) => ViewRenderer.VisualElementRendererMapper.UpdateProperty(h, v, nameof(IView.Scale)),
+ [nameof(IView.ScaleX)] = (h, v) => ViewRenderer.VisualElementRendererMapper.UpdateProperty(h, v, nameof(IView.ScaleX)),
+ [nameof(IView.ScaleY)] = (h, v) => ViewRenderer.VisualElementRendererMapper.UpdateProperty(h, v, nameof(IView.ScaleY)),
+ [nameof(IView.Rotation)] = (h, v) => ViewRenderer.VisualElementRendererMapper.UpdateProperty(h, v, nameof(IView.Rotation)),
+ [nameof(IView.RotationX)] = (h, v) => ViewRenderer.VisualElementRendererMapper.UpdateProperty(h, v, nameof(IView.RotationX)),
+ [nameof(IView.RotationY)] = (h, v) => ViewRenderer.VisualElementRendererMapper.UpdateProperty(h, v, nameof(IView.RotationY)),
+ [nameof(IView.AnchorX)] = (h, v) => ViewRenderer.VisualElementRendererMapper.UpdateProperty(h, v, nameof(IView.AnchorX)),
+ [nameof(IView.AnchorY)] = (h, v) => ViewRenderer.VisualElementRendererMapper.UpdateProperty(h, v, nameof(IView.AnchorY)),
};
public static CommandMapper CommandMapper
@@ -80,8 +100,16 @@ protected Frame? Element
Size IViewHandler.GetDesiredSize(double widthMeasureSpec, double heightMeasureSpec)
{
+ double minWidth = 20;
+ if (Primitives.Dimension.IsExplicitSet(widthMeasureSpec) && !double.IsInfinity(widthMeasureSpec))
+ minWidth = widthMeasureSpec;
+
+ double minHeight = 20;
+ if (Primitives.Dimension.IsExplicitSet(widthMeasureSpec) && !double.IsInfinity(heightMeasureSpec))
+ minHeight = heightMeasureSpec;
+
return VisualElementRenderer.GetDesiredSize(this, widthMeasureSpec, heightMeasureSpec,
- new Size(20, 20));
+ new Size(minWidth, minHeight));
}
protected override void Dispose(bool disposing)
diff --git a/src/Controls/tests/DeviceTests/Elements/Frame/FrameHandlerTest.Android.cs b/src/Controls/tests/DeviceTests/Elements/Frame/FrameHandlerTest.Android.cs
new file mode 100644
index 000000000000..561769152c7b
--- /dev/null
+++ b/src/Controls/tests/DeviceTests/Elements/Frame/FrameHandlerTest.Android.cs
@@ -0,0 +1,13 @@
+using System.Threading.Tasks;
+
+namespace Microsoft.Maui.DeviceTests
+{
+ public partial class FrameHandlerTest
+ {
+ public override Task ContainerViewInitializesCorrectly()
+ {
+ // https://github.com/dotnet/maui/pull/12218
+ return Task.CompletedTask;
+ }
+ }
+}
diff --git a/src/Controls/tests/DeviceTests/Elements/Frame/FrameHandlerTest.cs b/src/Controls/tests/DeviceTests/Elements/Frame/FrameHandlerTest.cs
index 90296019724b..db2f32b18406 100644
--- a/src/Controls/tests/DeviceTests/Elements/Frame/FrameHandlerTest.cs
+++ b/src/Controls/tests/DeviceTests/Elements/Frame/FrameHandlerTest.cs
@@ -1,11 +1,11 @@
-#if WINDOWS
+#if WINDOWS || ANDROID
using Microsoft.Maui.Controls.Handlers.Compatibility;
using Microsoft.Maui.DeviceTests.Stubs;
namespace Microsoft.Maui.DeviceTests
{
[Category(TestCategory.Frame)]
- public class FrameHandlerTest : HandlerTestBase
+ public partial class FrameHandlerTest : HandlerTestBase
{
public FrameHandlerTest()
{
diff --git a/src/Core/tests/DeviceTests.Shared/HandlerTests/HandlerTestBaseOfT.Tests.cs b/src/Core/tests/DeviceTests.Shared/HandlerTests/HandlerTestBaseOfT.Tests.cs
index ba4015c3a6c9..8f7094d6c319 100644
--- a/src/Core/tests/DeviceTests.Shared/HandlerTests/HandlerTestBaseOfT.Tests.cs
+++ b/src/Core/tests/DeviceTests.Shared/HandlerTests/HandlerTestBaseOfT.Tests.cs
@@ -148,7 +148,7 @@ public async Task NullSemanticsClass()
}
[Fact(DisplayName = "Clip Initializes ContainerView Correctly")]
- public async Task ContainerViewInitializesCorrectly()
+ public async virtual Task ContainerViewInitializesCorrectly()
{
var view = new TStub
{