Fix tip jar button width changing while purchasing

Closes #389
This commit is contained in:
Shadowfacts 2023-05-27 15:20:42 -07:00
parent e9727ac2c5
commit e8305184af
1 changed files with 5 additions and 1 deletions

View File

@ -77,8 +77,12 @@ struct TipJarView: View {
} }
} }
.onPreferenceChange(ButtonWidthKey.self) { newValue in .onPreferenceChange(ButtonWidthKey.self) { newValue in
if let buttonWidth {
self.buttonWidth = max(buttonWidth, newValue)
} else {
self.buttonWidth = newValue self.buttonWidth = newValue
} }
}
if let total = getTotalTips(), total > 0 { if let total = getTotalTips(), total > 0 {
Text("You've tipped a total of \(Text(total, format: products[0].0.priceFormatStyle)) 😍") Text("You've tipped a total of \(Text(total, format: products[0].0.priceFormatStyle)) 😍")