You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feature request: enable only the animations we need #153
It would be great to be able to pass the animations we need, like:
useAutoAnimate(['add','remove']);
My app uses react-beautiful-dnd and it doesn't work very well with 'remain', so in cases like this when we use other libraries with animations that might interfere with the behavior of the element, this function will be really useful.
Reacted by Oliver Meyer, Kevin Ashworth, Imad abdulkarim and Sebastian Wentworth
@yojona I use a similar library (dndkit) and solved this issue by disabling autoAnimate while I update the DOM after a dropped drag. It's a little tricky to get right, but it works, and as a nice side-effect, it preserves the "remain" animation when the list order is changing for other reasons.
It would be nice to have a bit more control over it and it's defaults.
Eg.: I want to override just add animation and keep others as default.
In theory we could modify the config to have: onAdd, onRemove, onRemain and if omitted it would pick the defaults for it. Probably solves two things at once, if user pass false to any of these, than it wouldn't animate that action.
I'm also trying to disable the add and remove animations and just keep the remain default animation.
I ended up forking it on our private monorepo and added the callbacks I said earlier, most likely the pull request wasn't going to be accepted so I didn't even tried to make one.
Reacted by Sebastian Wentworth and Diederik van den Burger
Landed in #255 ✨ — autoAnimate(el, { animations: { remain: false }, onAnimationEnd: (el, action) => {} }). Turn off just the animations you don't want (defaults stay for the rest), and get a callback when each one finishes. Works in every adapter; ships in the next release.
Activity
yojona commentedon Aug 8, 2023
I think this #118 is related
drmercer commentedon Sep 1, 2023
@yojona I use a similar library (dndkit) and solved this issue by disabling autoAnimate while I update the DOM after a dropped drag. It's a little tricky to get right, but it works, and as a nice side-effect, it preserves the "remain" animation when the list order is changing for other reasons.
felipedeboni commentedon Sep 18, 2024
It would be nice to have a bit more control over it and it's defaults.
Eg.: I want to override just add animation and keep others as default.
In theory we could modify the config to have: onAdd, onRemove, onRemain and if omitted it would pick the defaults for it. Probably solves two things at once, if user pass false to any of these, than it wouldn't animate that action.
wangyinyuan commentedon Oct 29, 2024
So is there any easy way to do this now?
I'm also trying to disable the
addandremoveanimations and just keep theremaindefault animation.felipedeboni commentedon Oct 30, 2024
I ended up forking it on our private monorepo and added the callbacks I said earlier, most likely the pull request wasn't going to be accepted so I didn't even tried to make one.
feat: animations option to turn off add/remove/remain, and onAnimatio…
justin-schroeder commentedon Nov 22, 2026
Landed in #255 ✨ —
autoAnimate(el, { animations: { remain: false }, onAnimationEnd: (el, action) => {} }). Turn off just the animations you don't want (defaults stay for the rest), and get a callback when each one finishes. Works in every adapter; ships in the next release.justin-schroeder commentedon Nov 23, 2026
Out now in
@formkit/auto-animate@0.11.0🚢