Skip to content

Commit 359363b

Browse files
committed
onchange updates remaining
1 parent ff921a5 commit 359363b

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

WooCommerce/Classes/View Modifiers/View+Measurements.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ extension View {
1414
.onAppear {
1515
callback(proxy.size.height)
1616
}
17-
.onChange(of: proxy.size.height) { newHeight in
17+
.onChange(of: proxy.size.height) { _, newHeight in
1818
callback(newHeight)
1919
}
2020
}
@@ -32,7 +32,7 @@ extension View {
3232
.onAppear {
3333
callback(proxy.size.width)
3434
}
35-
.onChange(of: proxy.size.width) { newWidth in
35+
.onChange(of: proxy.size.width) { _, newWidth in
3636
callback(newWidth)
3737
}
3838
}
@@ -48,10 +48,10 @@ extension View {
4848
.onAppear {
4949
callback(proxy.frame(in: .global))
5050
}
51-
.onChange(of: proxy.size.height) { newHeight in
51+
.onChange(of: proxy.size.height) { _, newHeight in
5252
callback(proxy.frame(in: .global))
5353
}
54-
.onChange(of: proxy.frame(in: .global)) { newHeight in
54+
.onChange(of: proxy.frame(in: .global)) { _, newHeight in
5555
callback(proxy.frame(in: .global))
5656
}
5757
}

WooCommerce/Classes/ViewRelated/ReusableViews/SwiftUI Components/FormattableAmountTextField.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ struct FormattableAmountTextField: View {
1818
ZStack(alignment: .center) {
1919
// Hidden input text field
2020
TextField("", text: $viewModel.textFieldAmountText)
21-
.onChange(of: viewModel.textFieldAmountText, perform: viewModel.updateAmount)
21+
.onChange(of: viewModel.textFieldAmountText) { _, newValue in
22+
viewModel.updateAmount(newValue)
23+
}
2224
.focused()
2325
.focused($focusAmountInput)
2426
.keyboardType(viewModel.allowNegativeNumber ? .numbersAndPunctuation : .decimalPad)

WooCommerce/Classes/ViewRelated/ReusableViews/SwiftUI Components/TopTabView.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ struct TopTabView<Content: View>: View {
172172
scrollFocusTab(in: scrollViewProxy, at: index)
173173
}
174174
}
175-
.onChange(of: geometry.size) { newSize in
175+
.onChange(of: geometry.size) { _, newSize in
176176
/// Support dynamic type size change
177177
if index < tabWidths.count {
178178
tabWidths[index] = newSize.width
@@ -194,11 +194,11 @@ struct TopTabView<Content: View>: View {
194194
.offset(x: underlineOffset),
195195
alignment: .bottomLeading
196196
)
197-
.onChange(of: selectedTab, perform: { newSelectedTab in
197+
.onChange(of: selectedTab) { _, newSelectedTab in
198198
withAnimation {
199199
selectTab(in: scrollViewProxy, at: newSelectedTab)
200200
}
201-
})
201+
}
202202
.coordinateSpace(name: Constants.tabsHorizontalStackNameSpace)
203203
}
204204
.padding(.horizontal, tabsContainerHorizontalPadding)
@@ -235,7 +235,7 @@ struct TopTabView<Content: View>: View {
235235
.onAppear {
236236
contentSize = contentGeometry.size
237237
}
238-
.onChange(of: contentGeometry.size) { newSize in
238+
.onChange(of: contentGeometry.size) { _, newSize in
239239
contentSize = newSize
240240
}
241241
})

0 commit comments

Comments
 (0)