fix: Fix setting props order issue for iOS. (#303)

fix #304
This commit is contained in:
Shingo YAMADE 2019-06-27 18:39:21 -07:00 committed by Dylan Vann
parent 5cb5d6bab3
commit 5597ed0dad
1 changed files with 19 additions and 2 deletions

View File

@ -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;
@ -97,6 +98,22 @@
- (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];