From 2b50609e5c475eec1b165d626fe79ed324300589 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sat, 20 Nov 2021 11:37:09 -0500 Subject: [PATCH] Fix animating poll configuration button size change when selected option changes --- Tusker/Screens/Compose/ComposePollView.swift | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Tusker/Screens/Compose/ComposePollView.swift b/Tusker/Screens/Compose/ComposePollView.swift index 27325bc3..f4354e80 100644 --- a/Tusker/Screens/Compose/ComposePollView.swift +++ b/Tusker/Screens/Compose/ComposePollView.swift @@ -59,19 +59,21 @@ struct ComposePollView: View { } HStack { - // use .animation(nil) on the binding and .frame(maxWidth: .infinity) on labels so frame doesn't have a size change animation when the text changes - Picker(selection: $poll.multiple.animation(nil), label: Text(poll.multiple ? "Allow multiple choices" : "Single choice").frame(maxWidth: .infinity)) { + // use .animation(nil) on pickers so frame doesn't have a size change animation when the text changes + Picker(selection: $poll.multiple, label: Text(poll.multiple ? "Allow multiple choices" : "Single choice")) { Text("Allow multiple choices").tag(true) Text("Single choice").tag(false) } + .animation(nil) .pickerStyle(MenuPickerStyle()) .frame(maxWidth: .infinity) - Picker(selection: $duration.animation(nil), label: Text(verbatim: ComposePollView.formatter.string(from: duration.timeInterval)!).frame(maxWidth: .infinity)) { + Picker(selection: $duration, label: Text(verbatim: ComposePollView.formatter.string(from: duration.timeInterval)!)) { ForEach(Duration.allCases, id: \.self) { (duration) in Text(ComposePollView.formatter.string(from: duration.timeInterval)!).tag(duration) } } + .animation(nil) .pickerStyle(MenuPickerStyle()) .frame(maxWidth: .infinity) }