From 2ea7d4c1c0225d4de77a9a8936770a468f660f9c Mon Sep 17 00:00:00 2001 From: Adlai Holler Date: Fri, 23 Dec 2016 09:46:49 -0500 Subject: [PATCH] By default, capture the current animation enabledness for collection/table updates (#2827) --- AsyncDisplayKit/ASCollectionView.mm | 3 ++- AsyncDisplayKit/ASTableView.mm | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/AsyncDisplayKit/ASCollectionView.mm b/AsyncDisplayKit/ASCollectionView.mm index bb0ea29a83..f90dedba83 100644 --- a/AsyncDisplayKit/ASCollectionView.mm +++ b/AsyncDisplayKit/ASCollectionView.mm @@ -749,7 +749,8 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell"; - (void)performBatchUpdates:(void (^)())updates completion:(void (^)(BOOL))completion { - [self performBatchAnimated:YES updates:updates completion:completion]; + // We capture the current state of whether animations are enabled if they don't provide us with one. + [self performBatchAnimated:[UIView areAnimationsEnabled] updates:updates completion:completion]; } - (void)registerSupplementaryNodeOfKind:(NSString *)elementKind diff --git a/AsyncDisplayKit/ASTableView.mm b/AsyncDisplayKit/ASTableView.mm index 60bf5df05b..fcbe83bca4 100644 --- a/AsyncDisplayKit/ASTableView.mm +++ b/AsyncDisplayKit/ASTableView.mm @@ -625,7 +625,8 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell"; - (void)endUpdates { - [self endUpdatesAnimated:YES completion:nil]; + // We capture the current state of whether animations are enabled if they don't provide us with one. + [self endUpdatesAnimated:[UIView areAnimationsEnabled] completion:nil]; } - (void)endUpdatesAnimated:(BOOL)animated completion:(void (^)(BOOL completed))completion;