Skip to content
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

Dragging snapback does not work #180

Open
gigilibala opened this issue Nov 27, 2024 · 2 comments
Open

Dragging snapback does not work #180

gigilibala opened this issue Nov 27, 2024 · 2 comments
Labels
animation Related to animations such as snapbacks bug Something isn't working duplicate This issue or pull request already exists

Comments

@gigilibala
Copy link

Tested this with both with react native old and new architecture and got the same issue. The dragging view does not snap back into place. The animation does not work (it stops before finishing). E.g. if you run the KnightMoves example, after dragging the knight and releasing it, the dragged view will stay there and won't snap back. I've narrowed it down to this line:

animation.start(({ finished }) => {

Where the finished value will always be false, hence the view state won't get updated in the drag registry.

Simulator.Screen.Recording.-.iPhone.16.-.2024-11-27.at.09.26.45.mp4
@HamzaJameel01
Copy link

@gigilibala Temporarily worked for me by commenting finish condition:

animation.start(({ finished }) => {
// Remove the release from tracking, regardless of whether animation finished.
deleteReleaseInRegistry(registry, releaseId);
// Call the snapback end handler, regardless of whether animation of finished.
onSnapbackEnd?.();
// If the animation finished, update the view state for the released view to be inactive.
// if (finished) {
stateDispatch(useDraxState_1.actions.updateViewState({
id: draggedId,
viewStateUpdate: {
dragStatus: types_1.DraxViewDragStatus.Inactive,
hoverPosition: undefined,
grabOffset: undefined,
grabOffsetRatio: undefined,
},
}));
// }
});

@lafiosca lafiosca added the bug Something isn't working label Dec 11, 2024
@LunatiqueCoder
Copy link

Isn't this a duplicate of #161 ?

@lafiosca lafiosca added duplicate This issue or pull request already exists animation Related to animations such as snapbacks labels Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
animation Related to animations such as snapbacks bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

4 participants