Is React Native's LayoutAnimation supported on Android?

后端 未结 4 1351
情歌与酒
情歌与酒 2021-02-05 07:35

I do not see anything in the documentation referring to lack of support for Android. I\'m using a simple preset animation:

LayoutAnimation.configureNext(LayoutAni

相关标签:
4条回答
  • 2021-02-05 07:58

    I did it like below. call imports UIManager,LayoutAnimation. like this:

    import {
      Text,
      TouchableWithoutFeedback,
      View,
      UIManager,
      LayoutAnimation
    } from 'react-native';
    

    then in constructor...add these two lines code...

    constructor(props) {
        super(props);
    
        UIManager.setLayoutAnimationEnabledExperimental &&
          UIManager.setLayoutAnimationEnabledExperimental(true);
      }
    
    0 讨论(0)
  • 2021-02-05 08:05

    First import the following:

     import  {
       UIManager,
       LayoutAnimation, Platform
     } from 'raect-native';
    

    then in component class :

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

    This is how it worked for me .

    0 讨论(0)
  • 2021-02-05 08:13

    writing both below lines work for my android htc desire pro 10

    LayoutAnimation.spring();
    
    UIManager.setLayoutAnimationEnabledExperimental && UIManager.setLayoutAnimationEnabledExperimental(true);
    
    0 讨论(0)
  • 2021-02-05 08:24

    As per this for Android support you have to add these lines:

     import  {
       UIManager,
       LayoutAnimation
     } from 'react-native';
    
     //..
    
     UIManager.setLayoutAnimationEnabledExperimental && UIManager.setLayoutAnimationEnabledExperimental(true);
    
    0 讨论(0)
提交回复
热议问题