Skip to content
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

ButtonStyle configuration.isPressed not updated properly #534

Open
usmansc opened this issue Apr 30, 2023 · 0 comments · May be fixed by #537
Open

ButtonStyle configuration.isPressed not updated properly #534

usmansc opened this issue Apr 30, 2023 · 0 comments · May be fixed by #537
Assignees
Labels
bug Something isn't working

Comments

@usmansc
Copy link

usmansc commented Apr 30, 2023

Describe the bug
ButtonStyle configuration.isPressed not updated properly

To Reproduce
The demo code is enough to reproduce the bug

Button("Pressed Button Style") {
    print("tapped")
}
.buttonStyle(
    PressedButtonStyle(pressedColor: Color.red)
)
struct PressedButtonStyle: ButtonStyle {
  let pressedColor: Color

  func makeBody(configuration: Configuration) -> some View {
    configuration.label
      .foregroundColor(configuration.isPressed ? pressedColor : .blue)
      .padding(15)
  }
}

Steps to reproduce the behavior:

  1. Press button and keep it pressed
  2. Move away from the button while still pressing the button
  3. Release
  4. Observe that .isPressed is still set to true

Expected behavior
.isPressed set to false and color change

Desktop (please complete the following information):

  • OS: [macOS 13.3.1]
  • Browser [chrome, safari]
  • Version of the browser [112.0.5615.137 and 16.4]
  • Version of Tokamak [0.11.0]
@usmansc usmansc added the bug Something isn't working label Apr 30, 2023
@ffried ffried linked a pull request Jul 19, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

2 participants