diff --git a/Lottie.Forms/Lottie.Forms.csproj b/Lottie.Forms/Lottie.Forms.csproj index 1a45f3c..d1b9c87 100644 --- a/Lottie.Forms/Lottie.Forms.csproj +++ b/Lottie.Forms/Lottie.Forms.csproj @@ -9,7 +9,7 @@ Lottie.Forms Render After Effects animations natively on Android, iOS, MacOS, TVOs and UWP Com.Airbnb.Xamarin.Forms.Lottie - 4.0.2 + 4.0.4 true diff --git a/Lottie.Forms/Platforms/Android/AnimationViewRenderer.cs b/Lottie.Forms/Platforms/Android/AnimationViewRenderer.cs index f33e599..0b37e7a 100644 --- a/Lottie.Forms/Platforms/Android/AnimationViewRenderer.cs +++ b/Lottie.Forms/Platforms/Android/AnimationViewRenderer.cs @@ -115,7 +115,10 @@ protected override void OnElementChanged(ElementChangedEventArgs _animationView.Speed = e.NewElement.Speed; _animationView.RepeatMode = (int)e.NewElement.RepeatMode; - _animationView.RepeatCount = e.NewElement.RepeatCount; + if (e.NewElement.RepeatMode == RepeatMode.Infinite) + _animationView.RepeatCount = int.MaxValue; + else + _animationView.RepeatCount = e.NewElement.RepeatCount; if (!string.IsNullOrEmpty(e.NewElement.ImageAssetsFolder)) _animationView.ImageAssetsFolder = e.NewElement.ImageAssetsFolder; _animationView.Scale = e.NewElement.Scale; @@ -174,7 +177,13 @@ protected override void OnElementPropertyChanged(object sender, PropertyChangedE _animationView.Speed = Element.Speed; if (e.PropertyName == AnimationView.RepeatModeProperty.PropertyName) + { _animationView.RepeatMode = (int)Element.RepeatMode; + if (Element.RepeatMode == RepeatMode.Infinite) + _animationView.RepeatCount = int.MaxValue; + else + _animationView.RepeatCount = Element.RepeatCount; + } if (e.PropertyName == AnimationView.RepeatCountProperty.PropertyName) _animationView.RepeatCount = Element.RepeatCount; diff --git a/Lottie.Forms/Platforms/Ios/AnimationViewRenderer.cs b/Lottie.Forms/Platforms/Ios/AnimationViewRenderer.cs index 0a87fb5..d118869 100644 --- a/Lottie.Forms/Platforms/Ios/AnimationViewRenderer.cs +++ b/Lottie.Forms/Platforms/Ios/AnimationViewRenderer.cs @@ -186,13 +186,13 @@ private void AnimationCompletionBlock(bool animationFinished) Element.InvokeRepeatAnimation(); _animationView.PlayWithCompletion(AnimationCompletionBlock); } - else if(Element.RepeatMode == RepeatMode.Restart && repeatCount < Element.RepeatCount) + else if (Element.RepeatMode == RepeatMode.Restart && repeatCount < Element.RepeatCount) { repeatCount++; Element.InvokeRepeatAnimation(); _animationView.PlayWithCompletion(AnimationCompletionBlock); } - else if(Element.RepeatMode == RepeatMode.Restart && repeatCount == Element.RepeatCount) + else if (Element.RepeatMode == RepeatMode.Restart && repeatCount == Element.RepeatCount) { repeatCount = 1; }