Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [53.6.2]
- [iOS] Fixed so Touch.Command will not be executed when long press is recognized.

## [53.6.1]
- [AlertView][Android] Fixed bug where buttons would not be visible if text size was increased and the Alert was not large.
- [AlertView][iOS] Fixed bug where `AlertView` would not show the custom truncation text if its visibility were set to false at the start.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class TouchEffectTapGestureRecognizer : UIGestureRecognizer
{
private UIView? m_uiView;
private readonly Action m_onTap;
private bool m_longPressDetected;

internal UIGestureRecognizerState m_currentState = UIGestureRecognizerState.Possible;

Expand Down Expand Up @@ -37,6 +38,7 @@ public override void TouchesBegan(NSSet touches, UIEvent evt)
{
base.TouchesBegan(touches, evt);

m_longPressDetected = false;
m_isCancelled = false;

TouchPlatformEffect.HandleTouch(UIGestureRecognizerState.Began, ref m_currentState, m_uiView);
Expand All @@ -46,17 +48,19 @@ public override void TouchesEnded(NSSet touches, UIEvent evt)
{
base.TouchesEnded(touches, evt);

if(m_currentState is not UIGestureRecognizerState.Cancelled)
if(!m_longPressDetected && m_currentState is not UIGestureRecognizerState.Cancelled)
m_onTap.Invoke();

TouchPlatformEffect.HandleTouch(UIGestureRecognizerState.Ended, ref m_currentState, m_uiView);
m_longPressDetected = false;
}

public override void TouchesCancelled(NSSet touches, UIEvent evt)
{
base.TouchesCancelled(touches, evt);

TouchPlatformEffect.HandleTouch(UIGestureRecognizerState.Cancelled, ref m_currentState, m_uiView);
m_longPressDetected = false;
}

public override void TouchesMoved(NSSet touches, UIEvent evt)
Expand All @@ -79,6 +83,11 @@ public override void TouchesMoved(NSSet touches, UIEvent evt)

private CGPoint? GetTouchPoint(NSSet touches) =>
(touches.AnyObject as UITouch)?.LocationInView(m_uiView);

public void NotifyLongPress()
{
m_longPressDetected = true;
}

protected override void Dispose(bool disposing)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ private void OnLongPress(UILongPressGestureRecognizer e)
if (e.State != UIGestureRecognizerState.Began)
return;

m_tapGestureRecognizer?.NotifyLongPress();

if (Touch.GetLongPressCommand(Element)?.CanExecute(Touch.GetLongPressCommandParameter(Element)) ?? false)
Touch.GetLongPressCommand(Element)?.Execute(Touch.GetLongPressCommandParameter(Element));
}
Expand Down