layoutanimation on android not work
Hey nowaits, thanks for reporting this issue!
React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.
react-native
or for more real time interactions, ask on Discord in the #react-native channel.UIManager.setLayoutAnimationEnabledExperimental && UIManager.setLayoutAnimationEnabledExperimental(true);
to enable LayoutAnimation on Android
This should be documented in LayoutAnimation
.
+1 @amiuhle
This SHOULD be documented in LayoutAnimation
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Where do I put this code?
@JasonScopServ Hey I usually put it to the constructor
:
import {UIManager} from 'react-native';
constructor() {
super();
if (Platform.OS === 'android') {
UIManager.setLayoutAnimationEnabledExperimental && UIManager.setLayoutAnimationEnabledExperimental(true);
}
}
This should really be documented, broke my head over this.
@janmarsicek Super helpful. I also wanted to ask is it possible to add the code somewhere else? I'm using react-native-stage-0 so I am just initializing state without constructor method.
Hi @jasan-s! According the docs it should be ok to set the following flags like in the example in https://github.com/facebook/react-native/blob/master/docs/Animations.md#layoutanimation-api Sorry I don't have time to check if it works...
One more thing to import Platform.
import { Platform } from 'react-native';
still not getting this to work with an actual animation, whether i set the flag in the app.js file or ini a component directly.
I manage to fix this issue. You guy can take a look in here
Could anyone answer:
If we use LayoutAnimation in several components - should we call
UIManager.setLayoutAnimationEnabledExperimental(true)
in each component, or we can just call it once?
Thanks
Most helpful comment
@JasonScopServ Hey I usually put it to the
constructor
: