我有一个从here采取的自定义布局动画。
var CustomLayoutAnimation = {
duration: 200,
create: {
type: LayoutAnimation.Types.linear,
property: LayoutAnimation.Properties.opacity,
},
update: {
type: LayoutAnimation.Types.curveEaseInEaseOut,
},
};
运行代码时,我收到以下警告
警告:配置类型失败:配置
config.update.type
在LayoutAnimation.configureNext
中标记为必需,但其值为undefined
。
代码有一个update.type条目,但警告说它未定义。我猜测,自写入要点以来,允许的值已经更新。我试图找出可用的允许条目列表,但它们没有列在React Native LayoutAnimation documentation中。
我想知道 :
每当我遇到这样的问题时,我都会去源代码。 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
不是支持的类型。从上面的列表中选择一个,我认为你应该好好去。希望这可以帮助!