forked from shadowfacts/Tusker
Fix poll button animation being weird on iOS 15
This commit is contained in:
parent
1d193dec0f
commit
bfee9ea124
@ -87,11 +87,26 @@ private struct LanguageButtonStyle: ButtonStyle {
|
||||
.padding(.vertical, 2)
|
||||
.padding(.horizontal, 4)
|
||||
.background(.tint.opacity(configuration.isPressed ? 0.15 : 0.2), in: RoundedRectangle(cornerRadius: 3))
|
||||
.animation(.linear(duration: 0.1), value: configuration.isPressed)
|
||||
.modifier(LanguageButtonStyleAnimationModifier(isPressed: configuration.isPressed))
|
||||
.padding(2)
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS, obsoleted: 16.0)
|
||||
private struct LanguageButtonStyleAnimationModifier: ViewModifier {
|
||||
let isPressed: Bool
|
||||
|
||||
func body(content: Content) -> some View {
|
||||
// This looks weird while the button is being pressed on iOS 15 for some reason.
|
||||
if #available(iOS 16.0, *) {
|
||||
content
|
||||
.animation(.linear(duration: 0.1), value: isPressed)
|
||||
} else {
|
||||
content
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private struct TogglePollButton: View {
|
||||
@ObservedObject var draft: Draft
|
||||
@FocusState.Binding var focusedField: FocusableField?
|
||||
|
Loading…
x
Reference in New Issue
Block a user