urmat abdykerimov
urmat abdykerimov

Reputation: 452

Rg.Plugin.Popup weird behavior

I have made side menu using Rg.Plugins.Popups for Xamarin.

Everything is ok, but appearing animation doesn't work for some reason. As you can see menu just appears out of nowhere when it should look like disappearing animation.

enter image description here

FilterMenuCommand = new Command(() =>
{
    var contentView = new ReportsPageFilterMenuContentView(this);
    PopupNavigation.Instance.PushAsync(new ReportsPageFilterMenuPopupPage(contentView, this));
});

My PopupPage class:

public partial class ReportsPageFilterMenuPopupPage : PopupPage
{
    public ReportsPageFilterMenuPopupPage(ReportsPageFilterMenuContentView contentView, ReportsViewModel viewModel)
    {
        InitializePageComponent(contentView, viewModel);
    }

    protected void InitializePageComponent(ReportsPageFilterMenuContentView contentView, ReportsViewModel viewModel, float width = 340.0f)
    {
        BindingContext = viewModel;
            

        var moveAnimation = new MoveAnimation
        {
            DurationIn = 800,
            DurationOut = 600,
            EasingIn = Easing.SinIn,
            EasingOut = Easing.SinOut,
            HasBackgroundAnimation = true,
            PositionIn = MoveAnimationOptions.Right,
            PositionOut = MoveAnimationOptions.Right,
        };

        Animation = moveAnimation;
        Resources["DecimalConverter"] = new DecimalConverter();

        var frame = new Frame
        {
            WidthRequest = width,
            CornerRadius = 0,
            Padding = new Thickness(24, 20, 24, 20),
            HorizontalOptions = LayoutOptions.End,
            VerticalOptions = LayoutOptions.StartAndExpand,
            BackgroundColor = Color.White
        };

        var gridRowDefinitions = new RowDefinitionCollection
        {
            new RowDefinition {Height = GridLength.Auto}, new RowDefinition {Height = GridLength.Star}
        };

        var grid = new Grid
        {
            RowDefinitions = gridRowDefinitions
        };

        var stackLayout = new StackLayout
        {
            Orientation = StackOrientation.Horizontal,
            BackgroundColor = Color.White
        };

        Grid.SetRow(stackLayout, 0);
        Grid.SetRow(contentView, 1);

        var label = new Label
        {
            FontFamily = "Roboto",
            FontAttributes = FontAttributes.Bold,
            FontSize = 20,
            VerticalOptions = LayoutOptions.Center,
            HorizontalOptions = LayoutOptions.Start,
            Margin = new Thickness(1),
            Text = MainResource.Filters
        };

        var imageButton = new ImageButton
        {
            Source = (FileImageSource)@"Assets/cross.png",
            VerticalOptions = LayoutOptions.Center,
            HorizontalOptions = LayoutOptions.EndAndExpand,
            Margin = new Thickness(1),
            Command = viewModel.CloseCommand
        };

        stackLayout.Children.Add(label);
        stackLayout.Children.Add(imageButton);

        grid.Children.Add(stackLayout);
        grid.Children.Add(contentView);
        frame.Content = grid;
            
        Content = frame;
    }
}

Xamarin.Forms version: 4.6.0.800
Rg.Plugins.Popup version: 2.0.0.3

If you have any clue or idea where to even start fixing this problem, please, share it with me in comments.

Upvotes: 0

Views: 433

Answers (1)

ColeX
ColeX

Reputation: 14475

I use your code and test on the following simulators

  • Android phone
  • Android tablet
  • iOS iPhone
  • iOS iPad

It works fine , the appearing and disappearing animation works as expected .

I would suggest you update Xamarin.Forms and Rg.Plugins.Popup version package to the latest .

Upvotes: 1

Related Questions