Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-17572] iOS: Fix activity indicator animation in list items #9716

Merged
merged 2 commits into from
Jan 16, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions iphone/Classes/TiUIListItem.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
#import "TiUtils.h"
#import "TiViewProxy.h"
#import "Webcolor.h"
#ifdef USE_TI_UIACTIVITYINDICATOR
#import "TiUIActivityIndicator.h"
#endif

@implementation TiUIListItem {
TiUIListItemProxy *_proxy;
Expand Down Expand Up @@ -91,6 +94,21 @@ - (void)prepareForReuse
{
RELEASE_TO_NIL(_dataItem);
[super prepareForReuse];

#ifdef USE_TI_UIACTIVITYINDICATOR
// TIMOB-17572: Attempt to resume activity indicator animation to reuse cell
// Use this workaroud until iOS is smart enough to retain the animation state itself
if (self.subviews.firstObject != nil) {
UIView *container = self.subviews.firstObject;
[[container subviews] enumerateObjectsUsingBlock:^(__kindof UIView *_Nonnull obj, NSUInteger idx, BOOL *_Nonnull stop) {
if ([obj isKindOfClass:[TiUIActivityIndicator class]]) {
UIActivityIndicatorView *activityIndicator = [(TiUIActivityIndicator *)obj indicatorView];
[activityIndicator startAnimating];
*stop = YES;
}
}];
}
#endif
}

- (void)layoutSubviews
Expand Down