Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Animation is not being started for the first time in the popup after showing that popup #279

Closed
Alex-Dobrynin opened this issue Apr 19, 2024 · 1 comment
Labels

Comments

@Alex-Dobrynin
Copy link

Alex-Dobrynin commented Apr 19, 2024

Description

I'm developer of MPowerKit.Popups library. And one of the users of this library experiencing an issue, when he has lottie animation in that popup and tries to open popup and the animation is not started for the first opening. but if user closes popup and open again the animation is started. Other views being rendered in the popup as expected all the time

There is workaround that forces to start lottie animation in the codebehind of the popup, that works, but it is ugly. Shortly, you can add the lottie animation view to the view tree from the codebehind after task delay. that code is below

Related issues:
MPowerKit/Popups#1
#264

Code

<?xml version="1.0" encoding="utf-8" ?>
<popup:PopupPage x:Class="MauiApp1.LoadingMopup"
                 xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
                 xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                 xmlns:local="clr-namespace:MauiApp1"
                 xmlns:popup="clr-namespace:MPowerKit.Popups;assembly=MPowerKit.Popups"
                 xmlns:skia="clr-namespace:SkiaSharp.Extended.UI.Controls;assembly=SkiaSharp.Extended.UI"
                 Title="PopupTestPage"
                 BackgroundColor="#80000000"
                 BackgroundInputTransparent="False"
                 CloseOnBackgroundClick="True">

    <ContentView BackgroundColor="Orange"
                 VerticalOptions="Center">
        <VerticalStackLayout x:Name="stack"
                             BackgroundColor="Purple"
                             HorizontalOptions="Center">
            <Label Text="kdjsnslhnsdhm;lsdhs" />
            <!--  comment here and uncomment in the codebehind  -->
            <skia:SKLottieView x:Name="LottieAnimation"
                               Margin="20"
                               Padding="0"
                               BackgroundColor="Blue"
                               HeightRequest="150"
                               IsAnimationEnabled="True"
                               RepeatCount="-1"
                               Source="cat.json"
                               WidthRequest="150" />
        </VerticalStackLayout>
    </ContentView>
</popup:PopupPage>
using SkiaSharp.Extended.UI.Controls;

namespace MauiApp1;

public partial class LoadingMopup : MPowerKit.Popups.PopupPage
{
    public LoadingMopup()
    {
        InitializeComponent();
        // Uncomment here
        //InitializeLottieAsync();
    }

    public async void InitializeLottieAsync()
    {
        await Task.Delay(1);
        SKLottieView myanimatedview = new()
        {
            Source = new SKFileLottieImageSource()
            {
                File = "cat.json"
            },
            RepeatCount = -1,
            IsAnimationEnabled = true,
            IsVisible = true,
            WidthRequest = 150,
            HeightRequest = 150,
            BackgroundColor = Colors.Blue,
            Margin = new Thickness(20),
        };
        stack.Add(myanimatedview);
    }
}

Expected Behavior

The animation started each time user opens the popup

Actual Behavior

The animation is not being started for the first time, after closing the popup and opening again the animation is being started.

Basic Information

  • Version with issue: Latest available.
  • Last known good version: unknown
  • IDE: VS 2022 for windows latest stable available
  • Platform Target Frameworks: Android
    • Android: 13,14, .net 8
      iOS- didn't test

Reproduction Link

LottiePopupTest.zip

@Alex-Dobrynin
Copy link
Author

fixed in my lib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant