Skip to content

Clarify use of UIManager for LayoutAnimation on Android #889

Closed

Description

@dev6james

https://facebook.github.io/react-native/docs/layoutanimation.html

This page says the following:

Note that in order to get this to work on Android you need to set the following flags via UIManager:
UIManager.setLayoutAnimationEnabledExperimental && UIManager.setLayoutAnimationEnabledExperimental(true);

What is unclear is if this needs to be done once globally, or on a per component basis. This should be made clearer.

Activity

  1. changed the title [-]Clarify use of UIManager for LayoutAnimation on Androod[/-] [+]Clarify use of UIManager for LayoutAnimation on Android[/+] on Apr 15, 2019
  2. dev6james commented on Apr 15, 2019

    @dev6james
    Author

    Note: I don't know what the answer to that is, because it's not in the docs. Lol.

  3. Simek commented on May 4, 2020

    @Simek
    Collaborator

    Hi @dev6james, it looks like PR #1191 improved the example but information you are looking for is still missing.

    From the React Native source code and internal examples I can tell you that setLayoutAnimationEnabledExperimental can be used globally (in the index file) or locally, inside the component. It would be nice if someone can confirm that and update the docs.

  4. added
    👋 Good first issueInterested in collaborating? Take a stab at fixing one of these issues.
    on May 4, 2020
  5. dev6james commented on May 5, 2020

    @dev6james
    Author

    Hi @dev6james, it looks like PR #1191 improved the example but information you are looking for is still missing.

    From the React Native source code and internal examples I can tell you that setLayoutAnimationEnabledExperimental can be used globally (in the index file) or locally, inside the component. It would be nice if someone can confirm that and update the docs.

    It would indeed :)

    Maybe I wasn't clear enough in the original post. I was trying to get a sense of: if one component calls setLayoutAnimationEnabledExperimental, does that mean it's globally activated for all components? Or is it only applied to the current component?

    I don't know the native implementation (nor should I need to) so it's not clear whether you can "pick and choose" which components to use it for.

  6. lorenz068 commented on Jun 5, 2020

    @lorenz068

    I test it and it works globally (setup in the top component (<App /> in my case)

  7. theprantadutta commented on Jun 15, 2026

    @theprantadutta
    Contributor

    Hi — happy to pick this up if it's still open for grabs.

    The note on the LayoutAnimation page still doesn't say whether setLayoutAnimationEnabledExperimental needs to be called once or per component. The page's own example sets the flag a single time at module scope, so the intent is "call it once before any layout animation runs," not per component — I'd make that explicit.

    While checking, I noticed the note is also partly outdated: on the New Architecture this method is a no-op (in dev it logs setLayoutAnimationEnabledExperimental is currently a no-op in the New Architecture.), so the flag isn't needed there at all.

    Proposed edit to docs/layoutanimation.md:

    • Clarify the flag only needs to be set once, near your app's entry point, before triggering a layout animation.
    • Add a short note that it's a no-op on the New Architecture, so it only applies to the old architecture.

    I'll keep it concise and follow the style guide. Does that scope sound right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    👻 Missing DocsDocumentation is missing👋 Good first issueInterested in collaborating? Take a stab at fixing one of these issues.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions