iOS 11 - Carousel page issues

Hi, I updated my project to use the latest Xamarin forms and the latest iOS 11 build. Previously my carousel page seemed to just swipe left to right/right to left. But since the update the carousel page swipe seems to lift the whole page, so if I were to tap on the top right and swipe diagonally left, the whole page seems to move down and across leaving a white background while switching pages. See attached image of me moving my finger down a bit as I swipe. As well as looking odd, it seems to be causing issues with the pull to refresh i have on the page - the pull to refresh event is not being fired in some cases.

Please help...

Best Answer

Answers

  • ISychev93ISychev93 RUMember ✭✭
    edited November 2017

    Hello.

    As a workaround, try following solution (which slove my problem):

    [assembly: ExportRenderer(typeof(BaseCarouselPage), typeof(BaseCarouselPageRenderer))]
    namespace Some.iOS.CustomRender
    {
        public sealed class BaseCarouselPageRenderer : CarouselPageRenderer
        {
            public override void ViewDidLoad()
            {
                base.ViewDidLoad();
    
                View.Subviews.OfType<UIScrollView>().Single().ContentInsetAdjustmentBehavior =
                    UIScrollViewContentInsetAdjustmentBehavior.Never;
            }
        }
    }
    

    Where BaseCarouselPage is

    namespace Some.XF.UI.BaseView
    {
        public class BaseCarouselPage : CarouselPage
        {
        }
    }
    
  • WilliamWattersonWilliamWatterson USUniversity ✭✭

    @ISychev93 - got around to trying this. Works great! Thank you v much

  • AdrianGhiAdrianGhi USMember ✭✭

    Are you sure this is working? I've tried and I still can pull down the CarouselPage or to right. So, this does not help..

  • WilliamWattersonWilliamWatterson USUniversity ✭✭

    @AdrianGhi - yes the exact code above works for me. So i created a custom renderer and then used the BaseCarouselPage in my page.

    then add it to the page like this.

    <base:BaseCarouselPage.BackgroundColor>
        <OnPlatform x:TypeArguments="Color"
                                Android="#F2F2F2"
                                iOS="#F2F2F2"></OnPlatform>
    </base:BaseCarouselPage.BackgroundColor>
    

  • AdrianGhiAdrianGhi USMember ✭✭

    And is doesn't look like this?? Because I have the same thing


  • WilliamWattersonWilliamWatterson USUniversity ✭✭

    No mine does not pull down at all now. Is a breakpoint being hit in your custom renderer to ensure its being applied?

  • Sanjay_RajputSanjay_Rajput USMember ✭✭

    @ISychev93 . Works great! Thank you v much

  • Conor.MurphyConor.Murphy GBMember ✭✭

    Thank you @ISychev93. I'm currently on 12.1 OS and it's still creating the bug. This saved me a lot of time!

Sign In or Register to comment.