LayoutAnimation.Types有哪些可用选项

问题描述 投票:0回答:1

我有一个从here采取的自定义布局动画。

var CustomLayoutAnimation = {
    duration: 200,
    create: {
      type: LayoutAnimation.Types.linear,
      property: LayoutAnimation.Properties.opacity,
    },
    update: {
      type: LayoutAnimation.Types.curveEaseInEaseOut,
    },
  };

运行代码时,我收到以下警告

警告:配置类型失败:配置config.update.typeLayoutAnimation.configureNext中标记为必需,但其值为undefined

代码有一个update.type条目,但警告说它未定义。我猜测,自写入要点以来,允许的值已经更新。我试图找出可用的允许条目列表,但它们没有列在React Native LayoutAnimation documentation中。

我想知道 :

  • 语法不再正确吗?
  • 是否有某个网页详细列出了可用的类型?
react-native layout-animation
1个回答
3
投票

每当我遇到这样的问题时,我都会去源代码。 Here's the file for LayoutAnimation.js from the react-native source code。基于此,我在第25行看到TypesEnum const声明,如下所示:

const TypesEnum = {
  spring: true,
  linear: true,
  easeInEaseOut: true,
  easeIn: true,
  easeOut: true,
  keyboard: true,
};

我怀疑这就是你错误的原因 - curveEaseInEaseOut不是支持的类型。从上面的列表中选择一个,我认为你应该好好去。希望这可以帮助!

© www.soinside.com 2019 - 2024. All rights reserved.