Closed ast3150 closed 5 months ago
It's working great with this fix! Thank you :)
hi @ast3150 could you check if the prior pr fixes the issue you are addressing for you?
@vladyslavsosiuk This prior pr fix, doesnt fix this Animation bug #19.
Do you have steps to reproduce?
Sure!
import Shimmer
import SwiftUI
struct ContentView: View {
var body: some View {
NavigationView { // Use NavigationStack here
VStack {
Text("NavigationView")
secondView()
}
}
}
}
struct secondView: View {
var body: some View {
RoundedRectangle(cornerRadius: 15)
.foregroundStyle(.red)
.frame(width: 50, height: 50)
.shimmering()
Text("This is the second View")
.redacted(reason: .placeholder)
.shimmering()
}
}
In my case the NavigationView and NavigationStack conflicted with the modifier. When NavigationView was used this happened:
https://github.com/markiv/SwiftUI-Shimmer/assets/83609361/c482dfe9-9260-4dbb-8d7d-67fd442187ef
and with NavigationStack this:
https://github.com/markiv/SwiftUI-Shimmer/assets/83609361/1c58a4d6-dc81-4bf9-9ad2-901245ad2429
When using the changes from this MR, the visuals are as expected.
This PR fixes the issue I was seeing where I was trying to apply a shimmer on a view within a NavigationStack
Prevent shimmer animation from affecting initial layout of the view
This introduces two changes:
Fixes #19