fix: Invalid items animation on screen change#396
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
a9f945c to
b3d532a
Compare
Closed
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes the invalid animation behavior of items during screen changes by updating layout animation conditions and refactoring animation logic. Key changes include:
- Updated comments and type definitions for layout animation across web and native platforms.
- Removed deprecated layout transition props and refactored animation logic in layout hooks.
- Added a debug option to trace animation flows in sortable components.
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/react-native-sortables/src/types/providers/shared.ts | Updated comment for shouldAnimateLayout to reflect its behavior on web resizing. |
| packages/react-native-sortables/src/types/props/shared.ts | Removed LayoutTransition type and its usage. |
| packages/react-native-sortables/src/providers/shared/hooks/useItemLayoutStyles.web.ts | Removed web-specific hook for item layout styles. |
| packages/react-native-sortables/src/providers/shared/hooks/useItemLayoutStyles.ts | Refactored animation updates for active/inactive items and simplified active item translation. |
| packages/react-native-sortables/src/providers/layout/grid/GridLayoutProvider.tsx | Modified the condition for animating the layout based on container resize state on web. |
| packages/react-native-sortables/src/providers/layout/flex/FlexLayoutProvider.tsx | Applied similar condition update as in GridLayoutProvider. |
| packages/react-native-sortables/src/constants/props.ts | Removed the itemsLayout property from default shared props. |
| packages/react-native-sortables/src/components/shared/SortableContainer.tsx | Adjusted animation trigger condition and added a debug prop to conditionally render the debug overlay. |
| packages/react-native-sortables/src/components/shared/DraggableView/ItemCell.tsx | Removed the unused layout prop for Animated.View. |
| packages/react-native-sortables/src/components/shared/DraggableView/DraggableView.tsx | Removed the layout prop following the upstream changes. |
| packages/react-native-sortables/src/components/shared/AnimatedOnLayoutView.tsx | Updated comment to clarify layout update behavior. |
| packages/react-native-sortables/src/components/SortableGrid.tsx | Removed itemsLayout prop and propagated the debug prop through grid components. |
| packages/react-native-sortables/src/components/SortableFlex.tsx | Removed itemsLayout prop and propagated the debug prop through flex components. |
Comments suppressed due to low confidence (3)
packages/react-native-sortables/src/providers/layout/grid/GridLayoutProvider.tsx:139
- The condition for determining when to animate layout on web has been inverted. Verify that this change correctly handles cases when the parent container is resized.
!IS_WEB || !previousProps?.mainGroupSize || props.mainGroupSize === previousProps.mainGroupSize
packages/react-native-sortables/src/providers/shared/hooks/useItemLayoutStyles.ts:95
- The active item update now sets translateX and translateY directly from position, without subtracting any layout offset. Please ensure that this change in offset handling is consistent with the intended UI behavior.
translateX.value = position.x;
packages/react-native-sortables/src/components/shared/SortableContainer.tsx:72
- The removal of the explicit IS_WEB check from the maybeAnimate function makes animation solely dependent on shouldAnimateLayout. Confirm that this change meets the intended animation behavior across different platforms.
animate && shouldAnimateLayout.value && value !== null
MatiPl01
pushed a commit
that referenced
this pull request
Jun 16, 2025
## [1.7.1](v1.7.0...v1.7.1) (2025-06-16) ### Bug Fixes * Flex layout issues ([#400](#400)) ([891c0b3](891c0b3)) * Flex layout with custom alignmnets on web ([#401](#401)) ([a74cb4b](a74cb4b)) * Invalid items animation on screen change ([#396](#396)) ([3262064](3262064)) * Items not animated before `sortEnabled` is set to `true` ([#398](#398)) ([5ff360c](5ff360c)) * Multi touch flickering issue ([#392](#392)) ([6427c8d](6427c8d))
Owner
Author
|
🎉 This issue has been resolved in version 1.7.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Description
Describe what was changed in this pull request
Changes showcase
Include example images/recordings if the new feature introduces some
visual changes or the PR fixes a UI bug