From 90fe427e3ee3a2c2d3d71b64ee4dffcd0b6f3138 Mon Sep 17 00:00:00 2001 From: Jakub Florkowski Date: Mon, 7 Jul 2025 01:09:34 +0200 Subject: [PATCH 1/2] MauiScrollView resets ContentOffset on first layout pass - fix --- src/Core/src/Platform/iOS/MauiScrollView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Core/src/Platform/iOS/MauiScrollView.cs b/src/Core/src/Platform/iOS/MauiScrollView.cs index 410871c7bae9..afb96eb8f724 100644 --- a/src/Core/src/Platform/iOS/MauiScrollView.cs +++ b/src/Core/src/Platform/iOS/MauiScrollView.cs @@ -64,7 +64,7 @@ public override void LayoutSubviews() crossPlatformLayout.CrossPlatformArrange(new Rect(new Point(-horizontalOffset, 0), crossPlatformBounds)); ContentOffset = new CGPoint(horizontalOffset, 0); } - else + else if (_previousEffectiveUserInterfaceLayoutDirection is not null) { ContentOffset = new CGPoint(0, ContentOffset.Y); } From af0cda6ee7f258b2fec862a4a0fccf3e97588811 Mon Sep 17 00:00:00 2001 From: Jakub Florkowski Date: Tue, 8 Jul 2025 00:38:02 +0200 Subject: [PATCH 2/2] Update MauiScrollView.cs --- src/Core/src/Platform/iOS/MauiScrollView.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Core/src/Platform/iOS/MauiScrollView.cs b/src/Core/src/Platform/iOS/MauiScrollView.cs index afb96eb8f724..563131738036 100644 --- a/src/Core/src/Platform/iOS/MauiScrollView.cs +++ b/src/Core/src/Platform/iOS/MauiScrollView.cs @@ -56,7 +56,7 @@ public override void LayoutSubviews() // For Right-To-Left (RTL) layouts, we need to adjust the content arrangement and offset // to ensure the content is correctly aligned and scrolled. This involves a second layout // arrangement with an adjusted starting point and recalculating the content offset. - if (_previousEffectiveUserInterfaceLayoutDirection != EffectiveUserInterfaceLayoutDirection) + if (_previousEffectiveUserInterfaceLayoutDirection is not null && _previousEffectiveUserInterfaceLayoutDirection != EffectiveUserInterfaceLayoutDirection) { if (EffectiveUserInterfaceLayoutDirection == UIUserInterfaceLayoutDirection.RightToLeft) { @@ -64,7 +64,7 @@ public override void LayoutSubviews() crossPlatformLayout.CrossPlatformArrange(new Rect(new Point(-horizontalOffset, 0), crossPlatformBounds)); ContentOffset = new CGPoint(horizontalOffset, 0); } - else if (_previousEffectiveUserInterfaceLayoutDirection is not null) + else { ContentOffset = new CGPoint(0, ContentOffset.Y); }