From 0e737ed86d0c75bfc1087421d65dfd8e972a2336 Mon Sep 17 00:00:00 2001 From: Jakub Florkowski Date: Mon, 16 Jun 2025 00:43:00 +0200 Subject: [PATCH 1/3] [iOS]CarouselView Position Not Respected When Changing From Hidden to Visible in CV2 - fix --- .../Handlers/Items2/iOS/CarouselViewController2.cs | 7 +++++++ .../Issues/CarouselViewUpdatePosition.xaml | 12 ++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/Controls/src/Core/Handlers/Items2/iOS/CarouselViewController2.cs b/src/Controls/src/Core/Handlers/Items2/iOS/CarouselViewController2.cs index 16c1365cd987..a5f53848918b 100644 --- a/src/Controls/src/Core/Handlers/Items2/iOS/CarouselViewController2.cs +++ b/src/Controls/src/Core/Handlers/Items2/iOS/CarouselViewController2.cs @@ -499,6 +499,13 @@ async Task UpdateInitialPosition() return; } + if(!ItemsView.IsVisible) + { + // If the CarouselView is not visible we don't want to set the initial position + // since it will be set when the CarouselView becomes visible + return; + } + if (ItemsSource is null) { return; diff --git a/src/Controls/tests/TestCases.HostApp/Issues/CarouselViewUpdatePosition.xaml b/src/Controls/tests/TestCases.HostApp/Issues/CarouselViewUpdatePosition.xaml index a093143a1675..f87ee577b471 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/CarouselViewUpdatePosition.xaml +++ b/src/Controls/tests/TestCases.HostApp/Issues/CarouselViewUpdatePosition.xaml @@ -14,20 +14,20 @@ Text="Tap the Button. If the item selected in the CarouselView is Item 4, the test has passed."/> - - + - - + + Item 1 Item 2 @@ -35,8 +35,8 @@ Item 4 Item 5 - - + +