【发布时间】:2020-06-26 08:09:23
【问题描述】:
我想为从 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 重新渲染/滚动/向上滚动行为。
有人可以帮我吗?
【问题讨论】:
标签: react-native react-native-flatlist react-native-animatable