Open Th3L0x opened 1 week ago
Has this happened to anyone else?
@Th3L0x Can you provide a small repro for me? Does this happen also with .net 8?
Sure, currently I'm not at home so I couldnt check if its working or not, but you will get the idea. As I remember this happened on dotnet 8.0 as well. BottomSheetTest.zip
@Th3L0x thanks, but your sample isn't working. Could you provide me something working?
Sorry, I think the deploying was not enabled in debug mode. I put a red background where the animation should be, it is also on the MainPage, and it works there.
@Th3L0x found the reason. SKLottieView.Window
is null and therefore the animation does not start playing.
I'm not sure if I want to release a new bug fix release since im working on a new major release.
Is it possible that you set the Window until the new version is released?
Either window.AddLogicalChild(lottieView)
or set the window on the top view of your content.
Thank you, I'm not sure if this is what you meant for but this way its working:
//BOTTOMSHEET BUG, will fixed in next release
private ScrollView? _scrollView;
private void ScrollView_BindingContextChanged(object sender, EventArgs e)
{
try
{
if (sender is ScrollView view && Shell.Current.CurrentPage?.Window != null)
{
_scrollView = view;
var lottiPrompt = view.FindByName<SKLottieView>("lottiPrompt");
var lottiLoad = view.FindByName<SKLottieView>("lottiLoad");
if (lottiPrompt != null)
{
Shell.Current.CurrentPage?.Window.AddLogicalChild(lottiPrompt);
lottiPrompt.BindingContext = this.BindingContext;
}
if (lottiLoad != null)
{
Shell.Current.CurrentPage?.Window.AddLogicalChild(lottiLoad);
lottiLoad.BindingContext = this.BindingContext;
}
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex);
}
}
private void BottomSheet_Closed(object sender, EventArgs e)
{
try
{
if (_scrollView != null && Shell.Current.CurrentPage?.Window != null)
{
var lottiPrompt = _scrollView.FindByName<SKLottieView>("lottiPrompt");
var lottiLoad = _scrollView.FindByName<SKLottieView>("lottiLoad");
if (lottiPrompt != null)
{
Shell.Current.CurrentPage?.Window.RemoveLogicalChild(lottiPrompt);
}
if (lottiLoad != null)
{
Shell.Current.CurrentPage?.Window.RemoveLogicalChild(lottiLoad);
}
_scrollView = null;
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex);
}
}
//BOTTOMSHEET BUG, will fixed in next release
Lottianimation (using SkiaSharp SkLottiView) in a bottomsheet does not start playing.