File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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" ]) {
You can’t perform that action at this time.
0 commit comments