-
Notifications
You must be signed in to change notification settings - Fork 118
[WCiOS17] Update .onchange()
usage to iOS17 API
#16002
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
Generated by 🚫 Danger |
@@ -79,7 +79,7 @@ struct ExpandableBottomSheet<AlwaysVisibleContent, ExpandableContent>: View wher | |||
// Always visible content | |||
alwaysVisibleContent() | |||
.trackSize(size: $fixedContentSize) | |||
.onChange(of: fixedContentSize, perform: { [fixedContentSize] _ in | |||
.onChange(of: fixedContentSize) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't seem we need the capture list here: .onChange(of: fixedContentSize)
already re-runs the closure every time fixedContentSize
changes, so capturing it when created serves no purpose as it will always have the latest value when the closure runs anyway
@@ -276,11 +276,11 @@ private struct CartScrollViewContent: View { | |||
.onAppear { | |||
updateItemImageVisibility(cartListWidth: geometry.size.width) | |||
} | |||
.onChange(of: geometry.size.width) { | |||
updateItemImageVisibility(cartListWidth: $0) | |||
.onChange(of: geometry.size.width) { _, newValue in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passing it implicitly as $0 is no longer something we can do, since we're using the new value inside the closure, we need to be declare it explicitly in .onChange
before using it.
Part of WOOMOB-1003
Description
This PR addresses ~50 warnings related to the
.onChange
usage across Order creation and POS, by moving them to use the new iOS17+ API.The previous API has been updated and deprecated from forcing us to use 1 parameter, to instead:
All changes are a refactor, so no behavior should be changed. Most of times we either don't care about the value and just react to it, or we care about
newValue
only.Testing information
Changes affect multiple files, but superficial smoke testing Order Creation and POS flows should be sufficient, ie:
Screenshots
N/A
RELEASE-NOTES.txt
if necessary.