我想对从 FlatList 中移除的项目进行动画移除。
我有一个自定义卡片组件作为 FlatList 中的项目。我垂直显示它。
现在,我想为项目的删除设置动画。可以从任何位置/索引中删除项目。
删除动画是,项目应该隐藏,下面的项目应该慢慢向上滑动。它应该是光滑的,我做了正常的它不光滑。我能够制作不透明动画,但 translateY 无法在卡上按要求工作。
使用以下动画隐藏已删除的卡片:
Animated.timing(this.animation, {
toValue: 1,
duration: 600,
// easing: Easing.linear,
delay: this.props.index * 1000,
}).start();
const animatedStyle = {
opacity: this.animation,
// transform: [
// {
// translateY: this.animation.interpolate({
// inputRange: [0, 1],
// outputRange: [0, 300],
// }),
// },
// ],
}
在卡片渲染()中
<Animated.View style={[animatedStyle]}>
......
// mycode
</Animated.View>
无法控制/动画 FlatList 重新渲染/滚动/向上滚动行为。
有人能帮我吗?