Skip to content

fix: Invalid items animation on screen change#396

Merged
MatiPl01 merged 4 commits intomainfrom
fix/invalid-animation-on-screen-change
Jun 15, 2025
Merged

fix: Invalid items animation on screen change#396
MatiPl01 merged 4 commits intomainfrom
fix/invalid-animation-on-screen-change

Conversation

@MatiPl01
Copy link
Copy Markdown
Owner

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

@MatiPl01 MatiPl01 self-assigned this Jun 13, 2025
@MatiPl01 MatiPl01 added the fix label Jun 13, 2025
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 13, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
react-native-sortables-docs ⬜️ Ignored (Inspect) Visit Preview Jun 15, 2025 2:51pm

@MatiPl01 MatiPl01 force-pushed the fix/invalid-animation-on-screen-change branch from a9f945c to b3d532a Compare June 13, 2025 18:48
@MatiPl01 MatiPl01 linked an issue Jun 15, 2025 that may be closed by this pull request
@MatiPl01 MatiPl01 requested a review from Copilot June 15, 2025 14:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 MatiPl01 marked this pull request as ready for review June 15, 2025 14:51
@MatiPl01 MatiPl01 merged commit 3262064 into main Jun 15, 2025
6 checks passed
@MatiPl01 MatiPl01 deleted the fix/invalid-animation-on-screen-change branch June 15, 2025 15:04
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))
@MatiPl01
Copy link
Copy Markdown
Owner Author

🎉 This issue has been resolved in version 1.7.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

First render animation

2 participants