Skip to content

Commit

Permalink
[Tab#713] Fix state.
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-zimmermann committed Jan 3, 2024
1 parent bb280a9 commit 9bad551
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions core/Sources/Components/Tab/View/SwiftUI/TabItemView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,10 @@ private struct TabItemButtonStyle: ButtonStyle {
var viewModel: TabItemViewModel<TabItemContent>

func makeBody(configuration: Self.Configuration) -> some View {
if configuration.isPressed != self.viewModel.isPressed {
DispatchQueue.main.async {
self.viewModel.isPressed = configuration.isPressed
}
}
return configuration.label
.animation(.easeOut(duration: 0.1), value: self.viewModel.isPressed)
.onChange(of: configuration.isPressed) { value in
self.viewModel.isPressed = value
}
.animation(.easeInOut(duration: 0.1), value: self.viewModel.isPressed)
}
}

0 comments on commit 9bad551

Please sign in to comment.