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

Fixed unordered setting props issue #303

Merged
merged 3 commits into from
Jun 28, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions ios/FastImage/FFFastImageView.m
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#import "FFFastImageView.h"


@interface FFFastImageView()

@property (nonatomic, assign) BOOL hasSentOnLoadStart;
@property (nonatomic, assign) BOOL hasCompleted;
@property (nonatomic, assign) BOOL hasErrored;
// Whether the latest change of props requires the image to be reloaded
@property (nonatomic, assign) BOOL needsReload;

@property (nonatomic, strong) NSDictionary* onLoadEvent;

Expand Down Expand Up @@ -97,7 +98,23 @@ - (void)sendOnLoad:(UIImage *)image {
- (void)setSource:(FFFastImageSource *)source {
if (_source != source) {
_source = source;

needsReload = YES;
}
}

- (void)didSetProps:(NSArray<NSString *> *)changedProps
{
if (needsReload) {
[self reloadImage];
}
}

- (void)reloadImage
{
needsReload = NO;

if (_source) {

// Load base64 images.
NSString* url = [_source.url absoluteString];
if (url && [url hasPrefix:@"data:image"]) {
Expand Down