Skip to content

Commit

Permalink
fix(reg): [Android] Flag released event has handle has no effect
Browse files Browse the repository at this point in the history
  • Loading branch information
dr1rrb committed Feb 2, 2022
1 parent 02d9cf8 commit 7353df5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Uno.UI/UI/Xaml/UIElement.Pointers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -781,17 +781,21 @@ internal void RaiseDrop(global::Windows.UI.Xaml.DragEventArgs args)
break;
case RoutedEventFlag.PointerReleased:
OnPointerUp(ptArgs, BubblingContext.OnManagedBubbling);
#if __IOS__

#if __IOS__ || __ANDROID__
// As the 'exit' is expected to be raised from 'up', if the 'up' event is handled
// (so we are bubbling event in managed code ... i.e. we are here),
// we do also have to generate (non bubbling) 'exit' to replicate that behavior.
// Note: We use the NoBubbling context in order to get the event raised locally (not IsInternal)!
OnPointerExited(ptArgs, BubblingContext.NoBubbling);
#elif __ANDROID__
// Ame reason as iOS, but we have to do that only for touches.

#if __ANDROID__ // On Android we inject 'exit' on 'up' only for touches
if (ptArgs.Pointer.PointerDeviceType is PointerDeviceType.Touch)
#endif
{
var wasHandled = ptArgs.Handled; // As we use NoBubbling, the OnPointerExited might reset the Handled flag
global::System.Diagnostics.Debug.Assert(wasHandled);
OnPointerExited(ptArgs, BubblingContext.NoBubbling);
ptArgs.Handled = wasHandled;
}
#endif
break;
Expand Down

0 comments on commit 7353df5

Please sign in to comment.