-
-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Toggle
value not updated when it's reset from a binding
#287
Labels
bug
Something isn't working
Comments
It seems that Full code: public struct ToggleDemo: View {
@State var checked = false
public var body: some View {
VStack {
Toggle("Toogle", isOn: $checked)
Text(checked ? "Checked" : "Not Checked")
Button(action:
{
self.checked.toggle()
},
label:
{
Text("Reset")
})
}
}
} |
Usually we uncheck the checkbox in JS like I find a modifier: |
MaxDesiatov
added a commit
that referenced
this issue
Nov 28, 2020
Resolve #287. The `checked` attribute is a peculiar one, as any value on it keeps the checkbox checked. Attribute updates in `DOMRenderer` don't handle removals of attributes, but this seems to be the only case where this is relevant. I've added special handling for this attribute and checkbox inputs, and also had to declare `HTMLAttribute.checked` to set `isUpdatedAsProperty: true` on it for it to fully work.
@RayZhao1998 a fix for this was included as a part of the latest 0.5.3 release. |
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Previously reported by @rbartolome. Here's a reproducible test case:
The text was updated successfully, but these errors were encountered: