Skip to content

Commit

Permalink
fix: Fix setting props order issue for iOS. (DylanVann#303)
Browse files Browse the repository at this point in the history
  • Loading branch information
yamade authored and DylanVann committed Jun 28, 2019
1 parent 5cb5d6b commit 5597ed0
Showing 1 changed file with 19 additions and 2 deletions.
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

0 comments on commit 5597ed0

Please sign in to comment.