我在使用 LayoutAnimation 动画从 ListView 删除一行时遇到困难。
由于 LayoutAnimation.spring 预设动画处理带有弹簧的视图更新和带有淡入淡出的视图创建,我预计底部现有的行在删除后会向上弹出。相反,它们逐渐消失。
使用 RN 0.18.1
let ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
var movies = [movie1, movie2, movie3, movie4, movie5];
...
renderRow(row) {
return <MovieRow key={row.movieId} />
}
...
// immutable delete of element in reducer (redux)
movies = movies.slice(0, 2).concat(movies.slice(3));
...
LayoutAnimation.spring();
this.setState({
dataSource: ds.cloneWithRows(movies)
});