Closed
Conversation
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 Agent can help with this pull request. Just |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
draggingItemis always reset: Added fallbackDropDelegates toProfileCollectionGridand a view-level.onDrophandler inProfileTabView. This ensuresdraggingItemis set tonileven if an item is dropped in empty space, preventing the tab bar from staying hidden indefinitely..animationmodifier fromProfileTabViewthat was conflicting with other animations. Replaced it with explicitwithAnimationcalls arounddraggingItemstate changes in bothProfileCollectionGridandProfileTabView. 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