Skip to content

Barra abas drag drop#477

Closed
lui7henrique wants to merge 2 commits intomainfrom
cursor/barra-abas-drag-drop-1562
Closed

Barra abas drag drop#477
lui7henrique wants to merge 2 commits intomainfrom
cursor/barra-abas-drag-drop-1562

Conversation

@lui7henrique
Copy link
Member

Describe your changes

This PR addresses a bug where the iOS tab bar would disappear permanently or briefly reappear and then vanish after a drag-and-drop operation in the Profile tab.

The fix involves two main parts:

  1. Ensuring draggingItem is always reset: Added fallback DropDelegates to ProfileCollectionGrid and a view-level .onDrop handler in ProfileTabView. This ensures draggingItem is set to nil even if an item is dropped in empty space, preventing the tab bar from staying hidden indefinitely.
  2. Resolving animation conflicts: Removed an implicit .animation modifier from ProfileTabView that was conflicting with other animations. Replaced it with explicit withAnimation calls around draggingItem state changes in both ProfileCollectionGrid and ProfileTabView. This prevents the tab bar from briefly reappearing and then disappearing again after a successful reorder.

Issue ticket number and link

N/A

Checklist before requesting a review

  • I have performed a self-review of my code
  • If it's an essential feature, I've tested it thoroughly.
  • Do we need to implement analytics?
  • Will this be part of a product update? If yes, please write one phrase about this update.

Open in Cursor Open in Web

cursoragent and others added 2 commits February 15, 2026 16:50
The iOS tab bar would disappear permanently when the user dropped a
dragged item outside of a valid drop target (e.g., between grid items,
on empty space, or anywhere other than directly on another item).

Root cause: draggingItem was only reset to nil inside
CollectionReorderDelegate.performDrop(), which is only called when the
drop lands on another grid item. Dropping elsewhere meant performDrop
was never called, so draggingItem stayed non-nil and the .toolbar
modifier kept the tab bar hidden.

Fix: Add fallback drop handlers at two levels:
1. GridFallbackDropDelegate on the LazyVGrid - catches drops that land
   in the grid area but between items (in spacing/padding)
2. .onDrop on the ZStack in ProfileTabView - catches drops that land
   anywhere on the profile tab (header, empty space below grid, etc.)

Both handlers reset draggingItem to nil and save the collection order,
ensuring the tab bar always reappears after a drag ends.

Co-authored-by: Luiz Henrique <7henrique18@gmail.com>
… for tab bar

The tab bar was disappearing again after a successful reorder because
the implicit .animation(.easeInOut, value: draggingItem != nil) modifier
on the NavigationStack content was creating a broad animation transaction
that conflicted with the .spring animation in dropEntered (used to
animate item movement during drag). These overlapping animation
contexts caused SwiftUI to incorrectly re-evaluate the .toolbar
visibility, making the tab bar briefly appear then hide again.

Changes:
- Remove the implicit .animation() modifier from ProfileTabView
- Use explicit withAnimation(.easeInOut) in .onDrag (when draggingItem
  is set) and in all performDrop handlers (when draggingItem is cleared)
- This ensures each animation is scoped precisely to its state change
  and cannot interfere with other concurrent animations

Co-authored-by: Luiz Henrique <7henrique18@gmail.com>
@cursor
Copy link

cursor bot commented Feb 15, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@vercel
Copy link

vercel bot commented Feb 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
plotwist Ready Ready Preview, Comment Feb 15, 2026 4:55pm

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants