在React Native Android中缺少插值类型

Chi*_*ahu 3 react-native react-native-android

这是我LayoutAnimation.configureNext(CustomLayoutAnimation);

var CustomLayoutAnimation = {
  duration: 10,
  create: {
    type: LayoutAnimation.Types.linear,
    property: LayoutAnimation.Properties.opacity
  },
  update: {
    type: LayoutAnimation.Types.curveEaseInEaseOut
  }
};
Run Code Online (Sandbox Code Playgroud)

在我的构造函数中

constructor(props: Object) {
    super(props);
    if (Platform.OS === "android") {
      UIManager.setLayoutAnimationEnabledExperimental &&
        UIManager.setLayoutAnimationEnabledExperimental(true);
    }
Run Code Online (Sandbox Code Playgroud)

但是ios在android中工作正常 在此处输入图片说明

小智 6

可能会迟到,但希望能对其他人有所帮助。

我最近在尝试使用LayoutAnimation在react native中工作时遇到了类似的问题。查看源代码给了我一些想法。在您的情况下,可能是curveEaseInEaseOut,而LayoutAnimation.js文件中的类型是easyInEaseOut。

这就是我定义自定义动画类型的方式。

const CustomLayoutLinear = {
  duration: 300,
  create: {
    type: LayoutAnimation.Types.linear,
    property: LayoutAnimation.Properties.opacity,
  },
  update: {
    type: LayoutAnimation.Types.linear,
  },
  delete: {
    duration: 50,
    type: LayoutAnimation.Types.linear,
    property: LayoutAnimation.Properties.opacity,
  },
};
Run Code Online (Sandbox Code Playgroud)