Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] SlideFlyoutTransition is not working after the xamarin forms update to xamarin forms 5 #13390

Closed
Srikanth540-L opened this issue Jan 13, 2021 · 0 comments · Fixed by #13494 · May be fixed by aleks-ivanov/maui#9
Closed
Labels
a/rtl s/unverified New report that has yet to be verified t/bug 🐛
Milestone

Comments

@Srikanth540-L
Copy link

Srikanth540-L commented Jan 13, 2021

SlideFlyoutTransition is not working after the xamarin forms update to xamarin forms 5

Description

We have requirement where the hamburger icon is in the right side of the screen and the flyout should move from RTL but the bottom tabs follow LTR to accomplish this we have gone for CustomShellRenderer where for iOS we are handling the transition.

at Xamarin.Forms.Platform.iOS.ShellFlyoutRenderer.Xamarin.Forms.IAppearanceObserver.OnAppearanceChanged (Xamarin.Forms.ShellAppearance appearance) [0x00022] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\ShellFlyoutRenderer.cs:25
at Xamarin.Forms.Shell.Xamarin.Forms.IShellController.AddAppearanceObserver (Xamarin.Forms.IAppearanceObserver observer, Xamarin.Forms.Element pivot) [0x00012] in D:\a\1\s\Xamarin.Forms.Core\Shell\Shell.cs:311
at Xamarin.Forms.Platform.iOS.ShellFlyoutRenderer.Xamarin.Forms.Platform.iOS.IShellFlyoutRenderer.AttachFlyout (Xamarin.Forms.Platform.iOS.IShellContext context, UIKit.UIViewController content) [0x000b5] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\ShellFlyoutRenderer.cs:83
at Xamarin.Forms.Platform.iOS.ShellRenderer.get_FlyoutRenderer () [0x00014] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\ShellRenderer.cs:76
at Xamarin.Forms.Platform.iOS.ShellRenderer.get_NativeView () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\ShellRenderer.cs:86
at Xamarin.Forms.Platform.iOS.Platform.AddChild (Xamarin.Forms.VisualElement view) [0x00035] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Platform.cs:356
at Xamarin.Forms.Platform.iOS.Platform.WillAppear () [0x0003c] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Platform.cs:339
at Xamarin.Forms.Platform.iOS.PlatformRenderer.ViewWillAppear (System.Boolean animated) [0x00018] in D:\a\1\s\Xamarin.Forms.Platform.iOS\PlatformRenderer.cs:95
at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSend_IntPtr(intptr,intptr,intptr)
at UIKit.UIWindow.set_RootViewController (UIKit.UIViewController value) [0x0000d] in /Library/Frameworks/Xamarin.iOS.framework/Versions/14.6.0.15/src/Xamarin.iOS/UIKit/UIWindow.g.cs:399
at Xamarin.Forms.Platform.iOS.FormsApplicationDelegate.UpdateMainPage () [0x0002d] in D:\a\1\s\Xamarin.Forms.Platform.iOS\FormsApplicationDelegate.cs:202
at Xamarin.Forms.Platform.iOS.FormsApplicationDelegate.ApplicationOnPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs args) [0x00012] in D:\a\1\s\Xamarin.Forms.Platform.iOS\FormsApplicationDelegate.cs:152
at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:266
at Xamarin.Forms.Element.OnPropertyChanged (System.String propertyName) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:362
at Xamarin.Forms.Application.set_MainPage (Xamarin.Forms.Page value) [0x0008b] in D:\a\1\s\Xamarin.Forms.Core\Application.cs:93
at AspenConnect.Services.NavigationService.GoToHome () [0x00008] in /Users/733728/Documents/GitHub/AspenConnect/AspenConnect/AspenConnect/Services/NavigationService.cs:217
at AspenConnect.ViewModels.LogInPageViewModel.OpenSettings (System.Boolean isFromLogin) [0x00231] in /Users/733728/Documents/GitHub/AspenConnect/AspenConnect/AspenConnect/ViewModels/LogInPageViewModel.cs:360

Steps to Reproduce

  1. Update the xamarin forms version to 5
  2. Add the above code to make your flyout transition from RTL
  3. Deploy the app in iOS device or simulator

Expected Behavior

Should work as it worked for prior stable version 4.8.

Actual Behavior

Not working is xamarin forms 5

Basic Information

  • Version with issue:

  • Last known good version:

  • Platform Target Frameworks:

    • iOS:
  • NuGet Packages: xamarin forms 5

  • Affected Devices: All iOS devices

Environment

LayoutViews will get for every click on hamburger icon but when we update the forms version to 5 it's not working and failing with above stack trace:

Show/Hide Visual Studio info
public class CustomShellRenderer : ShellRenderer
    {
      
        protected override IShellFlyoutRenderer CreateFlyoutRenderer()
        {
            return new ShellFlyoutRenderer()
            {
                FlyoutTransition = new SlideFlyoutTransition()
            };
        }
    }

public class SlideFlyoutTransition : IShellFlyoutTransition
    {
        public void LayoutViews(CGRect bounds, nfloat openPercent, UIView flyout, UIView shell, FlyoutBehavior behavior)
        {
           
            nfloat flyoutWidth = (nfloat)(Math.Min(bounds.Width, bounds.Height) * 0.9);
            nfloat openLimit = flyoutWidth;
            nfloat openPixels = openLimit * openPercent;

            if (behavior == FlyoutBehavior.Locked)
                shell.Frame = new CGRect(bounds.X + flyoutWidth, bounds.Y, bounds.Width - flyoutWidth, bounds.Height);
            else
                shell.Frame = bounds;

            var shellWidth = shell.Frame.Width;

            var positionY = shellWidth - openPixels;

            flyout.Frame = new CGRect(positionY, 0, flyoutWidth, bounds.Height);
        }
    }

Build Logs

Screenshots

Reproduction Link

Workaround

@Srikanth540-L Srikanth540-L added s/unverified New report that has yet to be verified t/bug 🐛 labels Jan 13, 2021
@samhouts samhouts added this to New in Triage Jan 13, 2021
@PureWeen PureWeen added this to the 5.0.0 milestone Jan 20, 2021
@PureWeen PureWeen added this to To do in vNext+1 (5.0.0) via automation Jan 20, 2021
@PureWeen PureWeen moved this from New to Ready For Work in Triage Jan 20, 2021
@Redth Redth moved this from Ready For Work to Needs Estimate in Triage Jan 21, 2021
@PureWeen PureWeen moved this from To do to In Progress in vNext+1 (5.0.0) Jan 21, 2021
Triage automation moved this from Needs Estimate to Closed Jan 26, 2021
vNext+1 (5.0.0) automation moved this from In Progress to Done Jan 26, 2021
rmarinho pushed a commit that referenced this issue Jan 26, 2021
* Fix NRE when using Custom Slide Transition

* - virtual
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/rtl s/unverified New report that has yet to be verified t/bug 🐛
Projects
Triage
  
Closed
3 participants