markiv / SwiftUI-Shimmer

Shimmer is a super-light modifier that adds a shimmering effect to any SwiftUI View, for example, to show that an operation is in progress. It works well on light and dark modes, and across iOS, macOS, tvOS, watchOS and visionOS.
MIT License
1.13k stars 62 forks source link

Animation bug #19

Closed ikok07 closed 10 months ago

ikok07 commented 11 months ago

When I launch my application for the first time the animation is not applied only to the redacted view but to the whole view:

This is my code:

ScrollView {
                    TodayFeaturedRecipesView()
                        .environmentObject(viewModel)
                        .tag(0)

                    TodayStatisticsView()
                        .environmentObject(viewModel)
                        .padding(.top)

                    if !(accManager.user?.isPremium ?? false) {
                        TodayFreeRecipesView()
                            .environmentObject(viewModel)
                        ExplorePremiumBannerView()
                            .redacted(reason: viewModel.isLoading ? .placeholder : [])
                            .shimmering(active: viewModel.isLoading, gradient: colorScheme == .dark ? K.Gradients.lightShimmeringGradient : K.Gradients.darkShimmeringGradient)
                    }
                }

image

image

ast3150 commented 10 months ago

We had the same issue and were able to fix it by introducing the changes from #20

Can you try if this fix works for you as well?

ikok07 commented 10 months ago

Yup, the issue was fixed! Thank you :)