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

iOS MaterialButton touch effect issue when using multiple buttons on one page #84

Closed
daniel-luberda opened this issue Feb 27, 2019 · 8 comments
Labels
bug Something isn't working valid This issue/bug/feature request is valid

Comments

@daniel-luberda
Copy link

Describe the bug
When having multiple buttons on one page, somehow when button clicked once - it flashes also after tapping other buttons.

Expected behavior
Button's background should not flash when other button is clicked

Screenshots
https://www.dropbox.com/s/t433v8ga8bmch8o/ripple_issue.mov?dl=0

@contrix09
Copy link

Can you provide me the sample XAML.

@contrix09 contrix09 self-assigned this Feb 27, 2019
@contrix09 contrix09 added the bug Something isn't working label Feb 27, 2019
@daniel-luberda
Copy link
Author

daniel-luberda commented Feb 27, 2019

Ok, that's tricky. I tried to prepare a sample project and couldn't reproduce it, then I noticed it's related to Command parameter binding.

I use custom ICommand implementation which raises CanExecuteChanged event every time to prevent multiple command execution before pending command task is finished (https://github.com/xamvvm/xamvvm/blob/master/source/Xamvvm.Core/Implementations/BaseCommand.cs)

with a Xamarin.Form.Command the issue is gone. I'll need to review it to have more info.

@contrix09 contrix09 added more info needed and removed bug Something isn't working labels Feb 27, 2019
@daniel-luberda
Copy link
Author

daniel-luberda commented Feb 27, 2019

Update:

  • It's definitely CanExecuteChanged. Somehow MaterialButton collides with it.
  • Only "flash" effect is affected with this issue.
  • CanExecuteChanged works just fine with Xamarin.Forms.Button.

@daniel-luberda
Copy link
Author

daniel-luberda commented Feb 27, 2019

https://github.com/xamarin/Xamarin.Forms/blob/3c3ecfd45489f119edfb922e01c0514a0bb74e2a/Xamarin.Forms.Core/ButtonElement.cs#L34-L54

As you see it changes IsEnabled property while animating. Currently MaterialButton doesn't handle it correctly.

@contrix09
Copy link

MaterialButton directly inherits Xamarin.Forms.Button and I think it handles the CanExecuteChanged of the Command property the same. The problem maybe in the iOS platform renderer of MaterialButton since it uses a UIGestureRecognizer to animate the control.

Can you try to provide a repro code using the custom ICommand implementation?

@daniel-luberda
Copy link
Author

Sure: MaterialButtonIssue.zip

@contrix09 contrix09 added bug Something isn't working valid This issue/bug/feature request is valid and removed more info needed labels Mar 1, 2019
@contrix09
Copy link

Hi. As I suspected, it was the MaterialButtonRenderer in the iOS platform. The animation for highlighting the background of the button was not being removed when the touch input has ended. But I don't know why the animation was being called from another button. What I did was to remove the highlight animation once the button was released.

You can see below the issue has been fixed:

image

@daniel-luberda
Copy link
Author

Great! :)

BTW: Thanks for such a nice lib!

@contrix09 contrix09 removed their assignment Sep 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working valid This issue/bug/feature request is valid
Projects
None yet
Development

No branches or pull requests

1 participant