Skip to content

Commit 5597ed0

Browse files
yamadeDylanVann
authored andcommitted
fix: Fix setting props order issue for iOS. (DylanVann#303)
fix DylanVann#304
1 parent 5cb5d6b commit 5597ed0

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

ios/FastImage/FFFastImageView.m

+19-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
#import "FFFastImageView.h"
22

3-
43
@interface FFFastImageView()
54

65
@property (nonatomic, assign) BOOL hasSentOnLoadStart;
76
@property (nonatomic, assign) BOOL hasCompleted;
87
@property (nonatomic, assign) BOOL hasErrored;
8+
// Whether the latest change of props requires the image to be reloaded
9+
@property (nonatomic, assign) BOOL needsReload;
910

1011
@property (nonatomic, strong) NSDictionary* onLoadEvent;
1112

@@ -97,7 +98,23 @@ - (void)sendOnLoad:(UIImage *)image {
9798
- (void)setSource:(FFFastImageSource *)source {
9899
if (_source != source) {
99100
_source = source;
100-
101+
needsReload = YES;
102+
}
103+
}
104+
105+
- (void)didSetProps:(NSArray<NSString *> *)changedProps
106+
{
107+
if (needsReload) {
108+
[self reloadImage];
109+
}
110+
}
111+
112+
- (void)reloadImage
113+
{
114+
needsReload = NO;
115+
116+
if (_source) {
117+
101118
// Load base64 images.
102119
NSString* url = [_source.url absoluteString];
103120
if (url && [url hasPrefix:@"data:image"]) {

0 commit comments

Comments
 (0)