这是什么意思?当我更新迭代视图列表时会发生这种情况
<View style={{ flexDirection: 'row', padding: 20, backgroundColor: '#fff' }}>
<Ionicons name={jobIcon} color={theme.iconColor} size={30} />
<Text>{jobService}</Text>
<Text>{jobDate}</Text>
</View>
Run Code Online (Sandbox Code Playgroud)
映射在scrollview中.
当我从子场景修改数组时弹出此错误.scene1 - 是带有作业列表数组视图sence2的ScrollView - 我删除作业的地方,当我删除作业时应该更新scene1
小智 16
如果您希望LayoutAnimation与ScrollView 一起使用,请替换
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut)
Run Code Online (Sandbox Code Playgroud)
和
LayoutAnimation.configureNext({
duration: 300,
create:
{
type: LayoutAnimation.Types.easeInEaseOut,
property: LayoutAnimation.Properties.opacity,
},
update:
{
type: LayoutAnimation.Types.easeInEaseOut,
}
});
Run Code Online (Sandbox Code Playgroud)
这适用于 Android 和 iOS,没有任何崩溃。
当您在布局动画已经在处理时调用布局动画时,就会发生这种情况。iOS 会显示警告,而 Android 会因此错误而爆炸。当您使用同一组件中的 LayoutAnimation 时,您可以使用这个简单的模式来修复它。
layoutAnimation() {
if (!this.layoutAnimationActive) {
this.layoutAnimationActive = true;
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInOut, () => { this.layoutAnimationActive = false; });
}
}
Run Code Online (Sandbox Code Playgroud)
就我而言,我在ScrollView中使用了LayoutAnimation。里面有一张物品地图。从列表中删除项目时,会发生这种情况。不使用LayoutAnimation似乎工作正常。
| 归档时间: |
|
| 查看次数: |
3410 次 |
| 最近记录: |