Given the following view the favorite flag disappears, when showFavoriteFlag
is set to false
from outside – but that change is not animated. Why not? I’d expect the text “Test” to slide to the right, but instead it just appears there immediately, as soon as the favorite flag disappears.
struct HeaderComponent: View {
let timestamp: Date
@Binding var showFavoriteFlag: Bool
var body: some View {
HStack {
TimestampComponent(for: timestamp)
Spacer(minLength: 0)
Text("Test")
if showFavoriteFlag {
FavoriteFlagComponent()
}
}
.animation(.default, value: showFavoriteFlag)
}
}