Skip to content

[iOS] Fixing #28912 by only hiding context buttons when user already stopped dragging the cell #28914

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

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ internal sealed class ContextScrollViewDelegate : UIScrollViewDelegate

bool _isDisposed;
static WeakReference<UIScrollView> s_scrollViewBeingScrolled;
bool _draggingEnded;
UITableView _table;

public ContextScrollViewDelegate(UIView container, List<UIButton> buttons, bool isOpen)
Expand Down Expand Up @@ -90,6 +91,11 @@ public override void DraggingStarted(UIScrollView scrollView)
RemoveHighlight(scrollView);
}

public override void DraggingEnded(UIScrollView scrollView, bool willDecelerate)
{
_draggingEnded = true;
}

public void PrepareForDeselect(UIScrollView scrollView)
{
RestoreHighlight(scrollView);
Expand All @@ -114,13 +120,14 @@ public override void Scrolled(UIScrollView scrollView)
b.Frame = new RectangleF(scrollView.Frame.Width + (count - (i + 1)) * ioffset, 0, width, rect.Height);
}

if (scrollView.ContentOffset.X == 0)
if (_draggingEnded && scrollView.ContentOffset.X == 0)
{
IsOpen = false;
SetButtonsShowing(false);
RestoreHighlight(scrollView);

s_scrollViewBeingScrolled = null;
_draggingEnded = false;
ClearCloserRecognizer(GetContextCell(scrollView));
ClosedCallback?.Invoke();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1655,7 +1655,7 @@ void UpdateNavigationBarVisibility(bool animated)
return;

var hasNavBar = NavigationPage.GetHasNavigationBar(current);
if (!_navigation.TryGetTarget(out NavigationRenderer navigationRenderer))
if (_navigation.TryGetTarget(out NavigationRenderer navigationRenderer))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While can understand the changes in the ContextScrollViewDelegate class, I think need more context here? why are you changing this condition?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this change is not related to the main issue, but it is clearly a copy/paste bug and can cause NRE in the next line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to roll back this one if needed

{
navigationRenderer._hasNavigationBar = hasNavBar;
}
Expand Down