question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Disabling animations either per-component or globally

See original GitHub issue

I find the performance really suffers on some mobile devices whenever any animations are happening.

I’d ideally like to be able to disable animations per component, or if not, globally.

Ideally there’d be an option like so:

<ExpansionPanel animate={false}>
    ...
</ExpansionPanel>

As far as I can tell, this is not currently possible.

Firstly - is there a workaround where I can disable animations with css overrides?

Secondly - should this be considered for being added as a feature?

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

Your Environment

Tech Version
Material-UI 1.0.0-beta.33
React 16.2.0
browser any on low-powered devices

Thanks in advance!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:7
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

15reactions
oliviertassinaricommented, Nov 15, 2018

@jacobweber Yes, of course. You can do the following.

import { createMuiTheme } from '@material-ui/core';

const theme = createMuiTheme({
  props: {
    // Name of the component ⚛️
    MuiButtonBase: {
      // The properties to apply
      disableRipple: true, // No more ripple, on the whole application 💣!
    },
  },
  transitions: {
    // So we have `transition: none;` everywhere
    create: () => 'none',
  },
});

Some peope will want to enable this behavior conditionally, for instance when serving an android user. In these cases, they can dynamically change the theme value.

I think that it would be breat to have a demo in the documentation or at least have this use case listed under the FAQ. Anyone wants to work on it? Thank you!

6reactions
oliviertassinaricommented, Jun 18, 2018

@tom-james-watson We use theme.transitions.create() almost everywhere to create the transitions, by overriding this method in the theme, you should easily be able to disable the transition globally. Adding the fact that the theme can be nested, you should be able to build a <DisableTransition /> component easily to cherrypick.

@xemasiv The ripple can be disabled globally as documented here: https://material-ui.com/customization/themes/#properties.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Disabling animations either per-component or globally #10560
I'd ideally like to be able to disable animations per component, or if not, globally. Ideally there'd be an option like so: <ExpansionPanel ......
Read more >
Turn off Office animations - Microsoft Support
To turn off Microsoft 365 animations in Windows 7 or 8. Open the Ease of Access Center by pressing the Windows logo key...
Read more >
setAnimationsEnabled(_:) | Apple Developer Documentation
Animations are enabled by default. If you disable animations, code inside subsequent animation blocks is still executed but no animations actually occur.
Read more >
Skinned Mesh Renderer component - Unity - Manual
Disable this option to stop skinning when the GameObject is off-screen and ... Receive Global Illumination, Whether Unity provides global illumination data ...
Read more >
Docs • Svelte
Complete documentation for Svelte.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found