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);