Pass actual loaded image size to load (iOS).

Summary:
Motivation: The JavaScript image component's onLoad callback optionally
accepts dimensions width and height, allowing the parent of the image to
obtain the native size (without an extra bridge call). It was found that
the dimensions passed into this callback on iOS are frequently (0,0),
not the true native dimensions. This change ensures that the image's
dimensions are passed to the callback. (Examination of the initializer
for RCTImageSource, + (RCTImageSource *)RCTImageSource:(id)json,
indicates that not all code paths produce a size other than CGSizeZero.)
Closes https://github.com/facebook/react-native/pull/15116

Differential Revision: D5460979

Pulled By: javache

fbshipit-source-id: 2dca03c3aae974ef70e981039aa6a804b8e128c8
This commit is contained in:
Shir Levkowitz 2017-07-20 02:49:35 -07:00 committed by Facebook Github Bot
parent bc0717c6cc
commit ced1513b62
1 changed files with 2 additions and 1 deletions

View File

@ -364,7 +364,8 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
}
} else {
if (self->_onLoad) {
self->_onLoad(onLoadParamsForSource(source));
RCTImageSource *sourceLoaded = [source imageSourceWithSize:image.size scale:source.scale];
self->_onLoad(onLoadParamsForSource(sourceLoaded));
}
if (self->_onLoadEnd) {
self->_onLoadEnd(nil);