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

TouchEffect inside CollectionView DataTemplate not letting select item on Android #75

Closed
Estevete opened this issue Sep 23, 2020 · 8 comments · Fixed by #76
Closed

TouchEffect inside CollectionView DataTemplate not letting select item on Android #75

Estevete opened this issue Sep 23, 2020 · 8 comments · Fixed by #76
Labels
question Further information is requested

Comments

@Estevete
Copy link

Placing TouchEffect inside the DataTemplate of a CollectionView (I have tried Frame & Grid) does not work on Android.

I have tried by calling SelectionChangedCommand and doesn't work either.
I have tested on iOS and UWP and it works.

Repro link:
https://github.com/MADSENSE/Madsense.XamarinForms.Sample/tree/collection-view-frame-android-issue

@AndreiMisiukevich AndreiMisiukevich added the bug Something isn't working label Sep 23, 2020
@AndreiMisiukevich
Copy link
Owner

does it work with a content view?

@Estevete
Copy link
Author

I have tried and no. It doesn't work either with a ContentView

@YZahringer
Copy link
Contributor

I think it's not specific to CollectionView, TapGestureRecognizer does not work on any element with TouchEffect on Android

@AndreiMisiukevich
Copy link
Owner

So, probably this is the limitation of this package.
You should use TouchEff.Command for handling taps in CollectionView instead of default CollectionView's command.

@AndreiMisiukevich AndreiMisiukevich added question Further information is requested and removed bug Something isn't working labels Sep 24, 2020
@YZahringer
Copy link
Contributor

@AndreiMisiukevich I think the problem is on e.Handled = true. Any reason to handle the event? This one is not handled on iOS and UWP.

private void OnTouch(object sender, AView.TouchEventArgs e)
{
if (_effect?.IsDisabled ?? true) return;
if (IsAccessibilityMode)
{
return;
}
e.Handled = true;

@AndreiMisiukevich
Copy link
Owner

@AndreiMisiukevich I think the problem is on e.Handled = true. Any reason to handle the event? This one is not handled on iOS and UWP.

private void OnTouch(object sender, AView.TouchEventArgs e)
{
if (_effect?.IsDisabled ?? true) return;
if (IsAccessibilityMode)
{
return;
}
e.Handled = true;

Hm, I thought it makes sense to mark the event as "handled" if it's handled indeed :)
Do you think we can safely remove this line?

@YZahringer
Copy link
Contributor

I've done some tests and I don't see any issue without handling it. The e.Handled should be set to False, the default value is True.

I think the behavior should be the same on different platforms, the event should be handled on all or none. Currently is handled on Android but not on iOS or UWP.

I often define TouchEffect in a global Style, that's why I use GestureRecognizer in the element. It works well, TouchEffect provides visual states and the gestures execute the commands.

@AndreiMisiukevich
Copy link
Owner

I've done some tests and I don't see any issue without handling it. The e.Handled should be set to False, the default value is True.

I think the behavior should be the same on different platforms, the event should be handled on all or none. Currently is handled on Android but not on iOS or UWP.

I often define TouchEffect in a global Style, that's why I use GestureRecognizer in the element. It works well, TouchEffect provides visual states and the gestures execute the commands.

Well, if it works well even in the ScrollView sample, then I will appreciate submitting a PR with the fix :)
Would you like to do it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants