-
Notifications
You must be signed in to change notification settings - Fork 456
[Bug] iOS Touch Effects cause weird behavior with multiple selection enabled in CollectionView items #1157
Description
Description
In my project I have the following scenario: I have a CollectionView with a custom ItemTemplate. My custom ItemTemplate has TouchEffects applied on it. There is an option to disable those touch effects via a binding. I create a BindableProperty for my custom ItemTemplate and set a binding on it which can be controlled from outside. When that property changes I remove/add the TouchEffects.
Everything is OK on Android. But on iOS the LongPressCommand doesn't seem to go away for some reason.
I've isolated the problem into a separate project and put it into a github repo, so you guys could inspect it better.
https://github.com/meJevin/TouchEffectBug
Please pay attention to Controls/TestTemplate.xaml
and its code-behind file. This is my custom template. In code behind I have a bindable property, which, when changes, adds or removes touch effects.
You can see how I use that template in MainPage.xaml
.
When run, application will not have any touch effects. Press the 'Change Template' button on the top in order to trigger a property change and therefore add effects to the ItemTemplate.
After that you will be able to long press it.
Press the button at the top again to trigger the removal of touch effects.
On Android everything works as expected. On iOS however, long pressing an item still calls the LongPressCommand (that we removed).
Steps to Reproduce
- Go to https://github.com/meJevin/TouchEffectBug
- Clone repo to your PC
- Run application on Android emulator (or device)
- Verify that there are no TouchEffects on current ItemTemplate by long pressing a CollectionView item (nothing should happen)
- Press 'Change Template' to add TouchEffects (including LongPressCommand)
- Verify that TouchEffects have been applied to CollectionView Items by long pressing one of them.
- Press 'Change Template' to remove TouchEffects
- Verify that there are no TouchEffects on current ItemTemplate by long pressing a CollectionView item (nothing should happen)
- Repeat steps 3-8 on an iOS device and you will fail on the 8th step. Because LongPressCommand still fires.
Expected Behavior
Android and iOS behavior is the same
Actual Behavior
iOS can not remove LongPressCommand
Basic Information
- Version with issue: 1.1.0
- Last known good version: -
- iOS: 14.4.2
- Nuget Packages: Xamarin.Forms 5.0.0.2012, Xamarin.Essentials 1.6.1, Xamarin.CommunityToolkit 1.1.0
- Affected Devices: iPhone 11