@@ -163,10 +163,10 @@ - (void)setRenderingMode:(UIImageRenderingMode)renderingMode
163163 }
164164}
165165
166- - (void )setSource : (NSArray <RCTImageSource *> *)source
166+ - (void )setImageSources : (NSArray <RCTImageSource *> *)imageSources
167167{
168- if (![source isEqual: _source ]) {
169- _source = [source copy ];
168+ if (![imageSources isEqual: _imageSources ]) {
169+ _imageSources = [imageSources copy ];
170170 [self reloadImage ];
171171 }
172172}
@@ -221,13 +221,13 @@ - (void)clearImageIfDetached
221221
222222- (BOOL )hasMultipleSources
223223{
224- return _source .count > 1 ;
224+ return _imageSources .count > 1 ;
225225}
226226
227227- (RCTImageSource *)imageSourceForSize : (CGSize)size
228228{
229229 if (![self hasMultipleSources ]) {
230- return _source .firstObject ;
230+ return _imageSources .firstObject ;
231231 }
232232 // Need to wait for layout pass before deciding.
233233 if (CGSizeEqualToSize (size, CGSizeZero)) {
@@ -238,7 +238,7 @@ - (RCTImageSource *)imageSourceForSize:(CGSize)size
238238
239239 RCTImageSource *bestSource = nil ;
240240 CGFloat bestFit = CGFLOAT_MAX;
241- for (RCTImageSource *source in _source ) {
241+ for (RCTImageSource *source in _imageSources ) {
242242 CGSize imgSize = source.size ;
243243 const CGFloat imagePixels =
244244 imgSize.width * imgSize.height * source.scale * source.scale ;
@@ -261,7 +261,8 @@ - (void)reloadImage
261261{
262262 [self cancelImageLoad ];
263263
264- _imageSource = [self imageSourceForSize: self .frame.size];
264+ RCTImageSource *source = [self imageSourceForSize: self .frame.size];
265+ _imageSource = source;
265266
266267 if (_imageSource && self.frame .size .width > 0 && self.frame .size .height > 0 ) {
267268 if (_onLoadStart) {
@@ -286,7 +287,6 @@ - (void)reloadImage
286287 imageScale = _imageSource.scale ;
287288 }
288289
289- RCTImageSource *source = _imageSource;
290290 __weak RCTImageView *weakSelf = self;
291291 RCTImageLoaderCompletionBlock completionHandler = ^(NSError *error, UIImage *loadedImage) {
292292 [weakSelf imageLoaderLoadedImage: loadedImage error: error forImageSource: source];
0 commit comments