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

Can we have option to disable animation in some components? #16943

Closed
1 task done
hieuhlc opened this issue Jun 4, 2019 · 10 comments
Closed
1 task done

Can we have option to disable animation in some components? #16943

hieuhlc opened this issue Jun 4, 2019 · 10 comments
Assignees
Labels
help wanted The suggestion or request has been accepted, we need you to help us by sending a pull request. Inactive

Comments

@hieuhlc
Copy link

hieuhlc commented Jun 4, 2019

  • I have searched the issues of this repository and believe that this is not a duplicate.

What problem does this feature solve?

It would be great if we have option to disable animation or at least customize them in some components such as Tree or Modal.

What does the proposed API look like?

For example Tree component with prop animation={false} will render the tree without CSSMotion component wrapped around it

@zombieJ
Copy link
Member

zombieJ commented Jun 4, 2019

Hi, what's the background on don't want the animation?

@hieuhlc
Copy link
Author

hieuhlc commented Jun 5, 2019

@zombieJ my Tree component have hundreds of item and I don't want to have animation to cost performance of the tree on expand / collapse (this is main reason). Also when the tree expands, it overflows the container's height, which is fine, but the scrollbar keeps changing during the animation. You can see the gif below

record

^ This is minor, not very important.
Thanks for the good work on antd btw.

@zombieJ
Copy link
Member

zombieJ commented Jun 6, 2019

Since animation works close with component, make it configurable may not easy at the moment. We may need social Volunteer to help on this.

@zombieJ zombieJ added the help wanted The suggestion or request has been accepted, we need you to help us by sending a pull request. label Jun 6, 2019
@muzea
Copy link
Contributor

muzea commented Jul 15, 2019

Is it acceptable to add ‘disable animation’ option to ConfigProvider?

@zombieJ
Copy link
Member

zombieJ commented Jul 15, 2019

@muzea, I'm OK with it.

@muzea
Copy link
Contributor

muzea commented Jul 15, 2019

Is there any good way to measure how much performance will improve after removing the animation? Is there any indicator for the user to measure whether it is worthwhile to remove the animation?

@zombieJ
Copy link
Member

zombieJ commented Jul 16, 2019

For above example. The best way is to support virtual list which has been planed in v4.

Satloff added a commit to Satloff/ant-design that referenced this issue Dec 12, 2019
Satloff added a commit to Satloff/ant-design that referenced this issue Dec 12, 2019
@kaiyoma
Copy link

kaiyoma commented Feb 13, 2021

Has there been any work done in this area? Or is there another issue that better tracks the discussion?

I would be interested in a way to easily disable all animations/transitions on all components. The reason is that we run a lot of UI tests (using Cypress) against our app and the Ant component animations cause random errors and test failures. We would like to disable animations, but only for our tests.

@Aaronius
Copy link

It seems like setting motion={null} on the Tree component works. It's not a documented prop, but you can see where it comes into play here.

@dyram-ivoyant-eng
Copy link

You can use motion={0} when using AntD v5.x.

The original solution for motion={null} worked in AntD v4.x but did not stop animations in 5.x hence replacing null with 0 worked for me.

@hieuhlc hieuhlc closed this as completed May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted The suggestion or request has been accepted, we need you to help us by sending a pull request. Inactive
Projects
None yet
Development

No branches or pull requests

8 participants