-
Notifications
You must be signed in to change notification settings - Fork 69
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] SKLottieView not working in Popup #142
Comments
We are seeing similar behavior when adding a Lottie animation to a page that is navigated to, instead of the main page of the app. If we put the SKLottieView on the main page of the app, it works perfectly, but if we put the SKLottieView on a secondary page that is navigated to, it displays the first frame of the animation but does not animate. |
That is true @johnwilson-wsh On Android the animation is not being displayed, and macOS the image is displayed however it is not animated. Please find below a few video samples for further information of the issue (macOS, Android and iOS): Community.Toolkit.Popup.-.Lottie.Animation.-.macOS.mp4Android.Emulator.-.Community.Toolkit.-.Lottie.movCommunity.Toolkit.Popups.and.Lottie.mov |
Just for info, maybe it helps as a workaround: I expirienced the same issue on iOS (SKLottieView loaded but did not play animation since it stopped before the first frame). I solved the issue by using Async Initialization with a short delay, after which the LottieAnimation IsAnimationEnabled property is set to true (set to false in XAML). See code example below
|
This is still an issue for me despite @VToegel's workaround - when I launch a popup from anywhere but a page itself animations usually don't work, with the workaround it seems they have a higher chance of working but still don't sometimes. For context, this is using shell and ModalAnimated / FormSheet presentation style. Invoking on main thread doesn't make a difference. I didn't look much into it but enabling debug statistics shows 0 FPS on those animations. |
We are also experiencing this outside of popup situations. We've got a loading spinner set up in a |
It would be nice to have this fixed , even with the workround using mopups does not work |
@gabsamples6 i could only provide an example for Maui community toolkit popup. There the workaround works for sure. I am unfortunately not using mopups for the time being. Rgds Vinc |
@VToegel thanks for replying , I will revert to mauiCommunity toolkit for the popup (its bottom one) if this is not going to be fixed. So if you have anything that you can show because I cannot make it work thanks again |
@gabsamples6 Please find an example here: https://github.com/VToegel/MauiLottiePopupExample.git Works for me on windows, android and iOS. Reds Vinc |
@VToegel brilliant!! thank you! |
Came across this timing issue too when tried to display an animation in a CarouselView. Does anyone have an idea how to properly fix it? Checked the source code, but cannot see anything obvious. |
Looking closer, this appears to be the case because the MCT is not causing the Loaded event to fire |
We have a custom view that we use a loading view inside all of the screens. Here's how the view looks roughly <Grid
RowDefinitions="*,Auto,Auto,*"
x:Name="This"
IsVisible="{Binding IsBusy, Source={x:Reference This}}"
HorizontalOptions="Fill"
VerticalOptions="Fill"
RowSpacing="0">
<controls:Placeholder
IsBusy="{Binding IsBusy, Source={x:Reference This}}"
Aspect="AspectFit"
Width="300"
HorizontalOptions="Center"
VerticalOptions="Fill" />
<skia:SKLottieView
Grid.Row="1"
Source="loading_indicator.json"
RepeatCount="-1"
HeightRequest="32"
WidthRequest="55"
HorizontalOptions="Center" />
<Label
Grid.Row="2"
Text="{markupExtensions:Translate Loading}"
Style="{StaticResource MetadataLabelStyle}"
FontSize="{StaticResource LargeFontSize}"
Margin="8"
HorizontalTextAlignment="Center" />
<progress:ProgressBar
Grid.Row="3"
IsVisible="{Binding Progress, Converter={StaticResource IsNotNullConverter}, Source={x:Reference This}}"
Progress="{Binding Progress, Source={x:Reference This}}"
HeightRequest="8"
ProgressColor="{StaticResource AccentColor}"
HorizontalOptions="Fill"
VerticalOptions="End" />
</Grid> This view gets shown and hidden whenever the screen has an active loading process. The behavior we observe is that the animation doesn't work in the first screen, the first time the Lottie view is shown, the animation doesn't work. However, it works on the screens that come after. I tried adding the artificial delay workaround mentioned above, but it didn't help. |
How does this work using MVVM? I cannot get it to work for Lottie used in CarouselView items. Changing the binding to the |
I bind the lottiesource from the viewmodel, but IsAnimationEnabled is always set from code behind. But basically it should also work using a binding. I think its a timing issue and the question is if your viewmodel or the view is instantiated first. You can check that by setting breakpoints in viewmodel and view. |
Description
SKLottieView is not working in Popup view from the CommunityToolkit.Maui 1.2.0
Code
Expected Behavior
The animation should be visible or running.
Actual Behavior
SkLottieView isn't visible for Android
SKLottieView isn't running on iOS, MacCatalyst, and Android
Basic Information
Detailed IDE/OS information (click to expand)
Screenshots
Android
https://user-images.githubusercontent.com/111379715/190478947-cc427617-1798-442e-ae77-73f1b0d0488e.mov
iOS
https://user-images.githubusercontent.com/111379715/190477751-6a7d4488-52e3-4692-af6f-f2819fb4ff08.mov
MacCatalyst
https://user-images.githubusercontent.com/111379715/190476385-7c4b8d02-aa43-415f-ba77-13035ff395e8.mov
Reproduction Link
SKLottieViewBug.zip
The text was updated successfully, but these errors were encountered: