[英]Position bug while using framer-motion's Animated Presence
I have a sandbox that is basically a slider made in React, where old data gets replaced by new data every time the user presses the button Next or Previous.我有一个沙箱,基本上是用 React 制作的 slider,每次用户按下按钮 Next 或 Previous 时,旧数据都会被新数据替换。 I want to use framer motion to create some beautiful animations to the slider, and it works almost perfectly.I don't know why, but every time I press the button to got to the next item (or the previous one), the animation shifts the element down and then it goes back to normal.我想使用成帧器运动为 slider 创建一些漂亮的动画,它几乎可以完美运行。我不知道为什么,但每次我按下按钮进入下一个项目(或上一个项目)时,animation将元素向下移动,然后恢复正常。
I'll leave the link to the sandbox below, it will be easier to visualize the bug.我将在下面留下沙箱的链接,这样可以更容易地可视化错误。
You must add this props exitBeforeEnter
to the AnimatePresence
您必须将此道具exitBeforeEnter
添加到AnimatePresence
<AnimatePresence exitBeforeEnter initial={false} custom={back}>
// ...
</AnimatePresence>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.