Attach the gestures to the correct (container or platform) view#12108
Attach the gestures to the correct (container or platform) view#12108
Conversation
|
How do we even write tests for this... |
| handler.SetVirtualView(element); | ||
| element.Handler = handler; | ||
| handler.SetVirtualView(element); |
There was a problem hiding this comment.
@PureWeen I spotted this. In the real code, we set Handler first. It appears that SetVirtualView also sets things, but those need to run later? Not quite sure how this is as setting Handler calls SetVertualView, but SetVirtualView also sets the Handler.
Stepping through the code, I think Handler does all the work as SetVirtualView bails out right away as the first check is:
if (VirtualView == view)
return;So not even sure SetVirtualView is needed...
|
Will this also help with #7121 ? |
Not sure, this PR just fixes iOS. But let me confirm. |
It does not, but I think I found the cause and added a comment. |
|
/backport to net7.0 |
|
Started backporting to net7.0: https://github.com/dotnet/maui/actions/runs/4016766108 |
Description of Change
In Xamarin.Forms, the gestures were attached to the renderer not the actual view. This fixes #8330 because the FrameRenderer code was designed to work with gestures on the render.
In this PR I do 2 things:
_platformView = _handler.ToPlatform();instead of_platformView = _handler.PlatformViewto ensure that we use the container view / renderer._platformViewwhen doing checks because that is what the gesture is attached to.Issues Fixed
Fixes #8330
Notes
Fixing the gestures like this causes this: #12116
But this is already an issue on Android and Windows... This is a separate issue, but depending on what we decide there determines how we should fix this....