From 7d10196950b13b15dd8920ed0b7383f4f0e80e2a Mon Sep 17 00:00:00 2001 From: Mubaarak Hassan Date: Fri, 6 Aug 2021 17:19:43 +0200 Subject: [PATCH] Update CarouselViewImplementation.cs Fixed an issue on iOS where updating position of a CarouselView always transitions from the rightsize (forward). The CarouselView always bases the direction transition on the value of prevBtnClicked. --- .../CarouselViewImplementation.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CarouselView/CarouselView.FormsPlugin.iOS/CarouselViewImplementation.cs b/CarouselView/CarouselView.FormsPlugin.iOS/CarouselViewImplementation.cs index cb2d282..b5629b4 100644 --- a/CarouselView/CarouselView.FormsPlugin.iOS/CarouselViewImplementation.cs +++ b/CarouselView/CarouselView.FormsPlugin.iOS/CarouselViewImplementation.cs @@ -869,7 +869,7 @@ void SetArrows() } } - bool prevBtnClicked; + bool? prevBtnClicked; void PrevBtn_TouchUpInside(object sender, EventArgs e) { @@ -1180,9 +1180,10 @@ void SetCurrentPage(int position) if (Element.ItemsSource?.GetCount() > 0) { // Transition direction based on prevPosition or if prevBtn has been clicked - var navdirection = position >= prevPosition || !prevBtnClicked ? UIPageViewControllerNavigationDirection.Forward : UIPageViewControllerNavigationDirection.Reverse; + var navdirection = position >= prevPosition || (prevBtnClicked.HasValue ? !prevBtnClicked.Value : false) ? UIPageViewControllerNavigationDirection.Forward : UIPageViewControllerNavigationDirection.Reverse; - prevBtnClicked = false; + if(prevBtnClicked.HasValue) + prevBtnClicked = false; var firstViewController = CreateViewController(position);