react-native-website icon indicating copy to clipboard operation
react-native-website copied to clipboard

Clarify use of UIManager for LayoutAnimation on Android

Open dev6james opened this issue 5 years ago • 4 comments

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.

dev6james avatar Apr 15 '19 21:04 dev6james

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

dev6james avatar Apr 15 '19 21:04 dev6james

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.

Simek avatar May 04 '20 22:05 Simek

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.

dev6james avatar May 05 '20 14:05 dev6james

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

lorenz068 avatar Jun 05 '20 16:06 lorenz068