From b795c8061c5005dc7779903f4567b4a0928f592d Mon Sep 17 00:00:00 2001 From: yamade Date: Thu, 4 Oct 2018 15:51:44 -0700 Subject: [PATCH] Fixed set props issue --- ios/FastImage/FFFastImageView.m | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/ios/FastImage/FFFastImageView.m b/ios/FastImage/FFFastImageView.m index 5fa8d91ee..96aad7dbc 100644 --- a/ios/FastImage/FFFastImageView.m +++ b/ios/FastImage/FFFastImageView.m @@ -5,6 +5,9 @@ @implementation FFFastImageView { BOOL hasCompleted; BOOL hasErrored; NSDictionary* onLoadEvent; + + // Whether the latest change of props requires the image to be reloaded + BOOL needsReload; } - (id) init { @@ -67,7 +70,23 @@ - (void)sendOnLoad:(UIImage *)image { - (void)setSource:(FFFastImageSource *)source { if (_source != source) { _source = source; - + needsReload = YES; + } +} + +- (void)didSetProps:(NSArray *)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"]) {