Log image url when image size doesn't match.

Summary:
Sometimes I got error message about image size doesn't match, but I don't know which image is wrong.

Before:
<img width="376" alt="2016-05-31 11 03 58" src="https://cloud.githubusercontent.com/assets/8459/15662148/aa4e1d7e-2720-11e6-863a-aa7dd662460b.png">

After this PR:
<img width="377" alt="2016-05-31 10 59 21" src="https://cloud.githubusercontent.com/assets/8459/15662153/b5b1fd2a-2720-11e6-9807-c7e4aa314c4b.png">

**Test plan (required)**

```
<Image source={require('image!test')} />
```
And don't add this image into project, it would report errors when run it.
Closes https://github.com/facebook/react-native/pull/7840

Differential Revision: D3365467

Pulled By: nicklockwood

fbshipit-source-id: de3d5989ef0a3c443cce557901486c4770d4e906
This commit is contained in:
Li Jie 2016-05-31 05:18:17 -07:00 committed by Facebook Github Bot 6
parent 3ccd99fb53
commit eb69d036d5
1 changed files with 4 additions and 2 deletions

View File

@ -913,8 +913,10 @@ RCT_ENUM_CONVERTER(RCTAnimationType, (@{
if (!CGSizeEqualToSize(imageSource.size, CGSizeZero) && if (!CGSizeEqualToSize(imageSource.size, CGSizeZero) &&
!CGSizeEqualToSize(imageSource.size, image.size)) { !CGSizeEqualToSize(imageSource.size, image.size)) {
RCTLogError(@"Image source size %@ does not match loaded image size %@.", RCTLogError(@"Image source %@ size %@ does not match loaded image size %@.",
NSStringFromCGSize(imageSource.size), NSStringFromCGSize(image.size)); imageSource.imageURL.path.lastPathComponent,
NSStringFromCGSize(imageSource.size),
NSStringFromCGSize(image.size));
} }
return image; return image;