React Native LayoutAnimation scale doesn't work on android

399 views Asked by At

I am using react-native's LayoutAnimation custom component with maps. On ios animation works properly, but not on android. I'm changing component height

const HeightAnimation = {
duration: 200,
create: {
    type: LayoutAnimation.Types.linear,
    property: LayoutAnimation.Properties.scaleXY
},
update: {
    type: LayoutAnimation.Types.easeInEaseOut
}

}

1

There are 1 answers

4
Prateek Thapa On

You need to set the following flags via UIManager. Did you do this in your code?

if (Platform.OS === 'android') {
  if (UIManager.setLayoutAnimationEnabledExperimental) {
    UIManager.setLayoutAnimationEnabledExperimental(true);
  }
}

You could check the docs here -> https://reactnative.dev/docs/layoutanimation